Find the sum of all natural numbers from 1 through 1000 which are neither divisible by 5 nor by 2.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
simple and understandable....thank u :)
stupid me - forgot to subtract the multiples of 2 and 5
There is an typo below: "Thus, sum of numbers which are divisible by 2 OR 5 is".
Think you meant to subtract 50500 instead of 100500 😉
to find the desired answer, n = 1 ∑ 1 0 0 0 ( n ) − i = 1 ∑ 2 1 0 0 0 ( 2 i ) − k = 1 ∑ 5 1 0 0 0 ( 5 k ) + z = 1 ∑ 5 × 2 1 0 0 0 ( 5 × 2 z ) = n = 1 ∑ 1 0 0 0 ( n ) − 2 i = 1 ∑ 5 0 0 ( i ) − 5 k = 1 ∑ 2 0 0 ( k ) + 1 0 z = 1 ∑ 1 0 0 ( z ) we know ∑ x = 1 n ( x ) = 2 n ( n + 1 ) ,now substitute = 2 1 0 0 0 × 1 0 0 1 − 2 2 5 0 0 × 5 0 1 − 5 2 2 0 0 × 2 0 1 + 1 0 2 1 0 0 × 1 0 1 = 5 0 0 × 1 0 0 1 − 5 0 0 × 5 0 1 − 5 0 0 × 2 0 1 + 5 0 0 × 1 0 1 = 5 0 0 ( 1 0 0 1 − 5 0 1 − 2 0 1 + 1 0 1 ) = 5 0 0 × 4 0 0 = 5 × 4 × 1 0 0 0 0 = 2 0 0 0 0 0
for 1 to 10 1,3,7,9 This repeats for every next 10 digits
1+3+7+9 =20 , 11+13+17+19=20 + 40, 21+23+27+29=80+20 .........
so totally 20 + sum{n=1 to 99} of (40n+20) = 20 + 199980 = 200000
The famous tip...
From all the positive integers less or equal than 1 0 0 0 first exclude all the even numbers and than all the odd numbers divisible by 5 to get that the sum is S = ( 1 + 3 + 5 + … + 9 9 9 ) − ( 5 + 1 5 + … + 9 9 5 ) = ( 1 + 3 + … + 9 9 9 ) − 5 ( 1 + 3 + … + 1 9 9 ) .
Now, we can use formula 1 + 3 + … + ( 2 n − 1 ) = n 2 to get S = 5 0 0 2 − 5 ⋅ 1 0 0 2 = ( 5 2 − 5 ) ⋅ 1 0 0 2 = 2 0 ⋅ 1 0 0 0 0 = 2 0 0 0 0 0 .
Let S be the sum of all natural numbers from 1 through 1000 which are neither divisible by 5 nor by 2.
∑ j = 1 5 0 0 2 ∗ j − 1 = ( 5 0 0 ) 2
and,
5 ∗ ∑ j = 1 1 0 0 2 ∗ j − 1 = 5 ∗ ( 1 0 0 ) 2
⟹ S = 5 0 0 2 − 5 ∗ ( 1 0 0 ) 2 = 2 0 ∗ 1 0 4 = 2 0 0 0 0 0
Notice that the sum of all natural numbers between 1-1000 (both inclusive), which are neither divisible by 5 nor by 2 is simply:
Sum of all natural numbers between 1-1000 (both inclusive) - Sum of all multiples of 5 between 1-1000 (both inclusive) - Sum of all multiples of 2 between between 1-1000 (both inclusive) + Sum of all multiples of 10 between 1-1000 (both inclusive)
Therefore the answer is ( 1+2+3+...+1000) - (5+10+15+...+1000) - (2+4+6+...+1000) + (10+20+30+...+1000)
= (1000*1001)/2 - [5(200)(201)]/2 - [2(500)(501)]/2 + [10(100)(101)]/2
= [1000(1001-201-501+101)]/2
=500(400)
=200000
i figured out 2 solutions to this problem- 1) form the series then take the sum of the first four terms .subsequently the sum of these sums form an AP then proceed with calculations
2) find the sum of odd numbers up to 1000 then subtract the sum of the multiples of 5 which are not divisible by 10.
I used 2nd method of yours. Just wanted to correct you a bit that in 2nd point we have to find the sum of odd numbers form 1 to 1000 but then we don't have to subtract all multiples of 5. We only have to subtract those multiples of 5 which are not divisible by 10 or in other words end in digit 5 like 5, 15, 25,.........., 995.
Problem Loading...
Note Loading...
Set Loading...
We will start with finding the sum of all multiples of 2 or 5...
sum of all multiples of 2 is
2 5 0 0 ( 2 + 1 0 0 0 )
= 2 5 0 5 0 0
sum of all multiples of 5 is
2 2 0 0 ( 5 + 1 0 0 0 )
= 1 0 0 5 0 0
Now you will observe that numbers 10,20....i.e all the multiples of 10 occur in both the sum of the multiples of 2 and 5...
Therefore we must subtract the sum of all multiples of 10.
Sum of all multiples of 10 is
2 1 0 0 ( 1 0 + 1 0 0 0 )
= 5 0 5 0 0
Thus, sum of numbers which are divisible by 2 OR 5 is
= 2 5 0 5 0 0 + 1 0 0 5 0 0 − 1 0 0 5 0 0
= 3 0 0 5 0 0
Now if we subtract the above sum from the sum of all natural numbers up to 1000 we will get the desired result..
Sum of natural no. up to 1000 is
2 1 0 0 0 ( 1 0 0 1 )
= 5 0 0 5 0 0
Therefore,
Sum of all numbers which are neither divisible by 5 or 2 are
= 5 0 0 5 0 0 − 3 0 0 5 0 0
2 0 0 0 0 0