Find the sum of all the numbers less than 1000, which are neither divisible by 5 nor by 2.

We need to find the sum of all the numbers less than 1000, which are neither divisible by 5 nor by 2.

Numbers divisible by 2 upto 1000 are 2, 4 , 6, ........ 1000.

Sum of all the numbers divisible by 2 upto 1000 = 2 + 4 + 6 + ....... + 1000 = 2 (1 + 2 + 3 + .......... + 500)

[Using: sum of first *n* natural numbers]

Numbers divisible by 5 upto 1000 are 5, 10 , 15, ........ 1000.

Sum of all the numbers divisible by 5 upto 1000 = 5 + 10 + 15 + ....... + 1000 = 5 (1 + 2 + 3 + ........ + 200)

Let us find out the sum of all the numbers which are divisible by both 5 and 2.

Numbers divisible by both 2 and 5 will be divisible by 10.

The numbers upto 1000 which are divisible by 10 are: 10, 20, 30, 40, ............ 990, 1000.

Clearly, this forms an AP with *a* = 10, *d* = 10, *a _{n}* = 1000, where

*n*can be found out as follows:

*a _{n}* =

*a*+ (

*n*– 1)

*d*

⇒ 1000 = 10 + (*n* – 1) × 10

⇒*n* = 100

Sum of all the numbers upto 1000 = 1 + 2 + 3 + ........... + 999 + 1000

Sum of all the numbers less than 1000, which are neither divisible by 5 nor by 2 =

Sum of all the numbers upto 1000 – (Sum of all the numbers divisible by 2 upto 1000 + Sum of all the numbers divisible by 5 upto 1000 – Sum of all the numbers which are divisible by both 2 and 5)

= 500500 – (250500 + 100500 – 50500)

=** 200000**

**
**