# Find the sum of those integers from 1 to 500 which are multiples of 2 or 5.

#### Complete Python Prime Pack

9 Courses     2 eBooks

#### Artificial Intelligence & Machine Learning Prime Pack

6 Courses     1 eBooks

#### Java Prime Pack

9 Courses     2 eBooks

Given:

Integers from 1 to 500, which are multiplies of 2 or 5.

To do:

We have to find the sum of all integers from 1 to 500, which are multiplies of 2 or 5.

Solution:

Sum of integers that are multiples of 2 or 5 $=$ Sum of the multiples of 2 $+$ Sum of multiples of 5 which are not divisible by 2.

Numbers divisible by 2 from 1 to 500 are $2, 4, ......,500$

This series is in A.P.

Here,

First term $a=2$

Common difference $d=4-2=2$

Last term $a_n=500$

We know that,

$a_n=a+(n-1)d$

$500=2+(n-1)2$

$500-2=(n-1)2$

$498=(n-1)2$

$249=n-1$

$n=249+1$

$n=250$

We know that,

$\mathrm{S}_{n}=\frac{n}{2}[2 a+(n-1) d]$

$=\frac{250}{2}[2 \times 2+(250-1) \times 2]$

$=125[4+249 \times 2]$

$=125(4+498)$

$=125 \times 502$

$=62750$

Numbers divisible by 5 from 1 to 500 which are not divisible by 2 are $5, 15, ......,495$

This series is in A.P.

Here,

First term $a=5$

Common difference $d=15-5=10$

Last term $a_n=495$

We know that,

$a_n=a+(n-1)d$

$495=5+(n-1)10$

$495-5=(n-1)10$

$490=(n-1)10$

$49=n-1$

$n=49+1$

$n=50$

We know that,

$\mathrm{S}_{n}=\frac{n}{2}[2 a+(n-1) d]$

$=\frac{50}{2}[2 \times 5+(50-1) \times 10]$

$=25[10+49 \times 10]$

$=25(500)$

$=12500$

Therefore,

Sum of integers that are multiples of 2 or 5 $=62750+12500$

$=75250$

The sum of all integers from 1 to 500 which are multiples of 2 or 5 is $75250$.

Updated on 10-Oct-2022 13:27:44