by Guest » Mon Feb 11, 2013 10:29 am
Use the inclusion exclusion principle.
The sum of all integers which are divisble by 2 or 5
= The sum of all integers which are disible by 2
+ The sum of all integers which are disvisible by 5
- The sum of all integers that are divisible by 2 and 5 (i.e. are divisible by 10)
= (2 + 4 + 6 + ... + 100) + (5 + 10 + 15 + ... 100) - (10 + 20 + 30 + ... + 100)
= 2(1+2+3+...+50) + 5(1+2+3+...20) -10(1+2+3+...+10)
= 2(50x51/2) + 5(20x21/2) -10(10x11/2) (using the fact that 1+2+3+...+n = n(n+1)/2)
= 3050