Find the sum of numbers from 1 to 100 which are neither divisible by 2 nor by 5.
THEN ANSWER WILL BE -
The sum of all numbers which are divisible by 2 or 5 = sum of all numbers divisible by 2 + sum of all numbers divisible by 5 - sum of all numbers divisible by both 2 and 5
Firstly we will find the sum of all numbers between 1 to 100 which are divisible by 2 as:
The numbers divisible by 2 are: 2, 4, 6, 8, ......., 100.
Therefore, an = a + (n - 1)d
⇒ 100 = 2 + (n - 1)2
⇒ 98/2 = (n - 1)
⇒ n = 49 + 1 = 50
Similarly,
The numbers divisible by 5 are: 5, 10, 15, ......., 100.
Therefore, an = a + (n - 1)d
⇒ 100 = 5 + (n - 1)5
⇒ 95/5 = (n - 1)
⇒ n = 19 + 1 = 20
Again,
The numbers divisible by both 2 and 5 or multiples of 10 are : 10, 20, ......., 100.
Therefore, an = a + (n - 1)d
⇒ 100 = 10 + (n - 1)10
⇒ 90/10 = (n - 1)
⇒ n = 9 + 1 = 10
Sum of all numbers divisible by 2 or 5 = S50 + S20 - S10 = 2550+1050 -1100 = 2500
Again, sum of all numbers from 1 to 100
Now, sum of all numbers neither divisible by 2 nor by 5 = sum of all numbers from 1 to 100 - Sum of all numbers divisible by 2 or 5
= 5050 - 2500 = 2550