

InterviewSolution
1. |
Find the Sum of those integers from 1 to 500 which are multiples of 2 or 5. |
Answer» We know that, Multiples of 2 or 5 = Multiple of 2 + Multiple of 5 – Multiple of LCM (2, 5) Multiples of 2 or 5 = Multiple of 2 + Multiple of 5 – Multiple of LCM (10) Multiples of 2 or 5 from 1 to 500 = List of multiple of 2 from 1 to 500 + List of multiple of 5 from 1 to 500 – List of multiple of 10 from 1 to 500 = (2, 4, 6… 500) + (5, 10, 15… 500) – (10, 20, 30… 500) Required sum = sum(2, 4, 6,…, 500) + sum(5, 10, 15,…, 500) – sum(10, 20, 30,., 500) Consider the first series, 2, 4, 6, …., 500 First term, a = 2 Common difference, d = 2 Let n be no of terms an = a + (n – 1)d 500 = 2 + (n – 1)2 498 = (n – 1)2 n – 1 = 249 n = 250 Sum of an AP, Sn = (n/2) [ a + an] Let the sum of this AP be S1, S1 = S250 = (250/2) ×[2+500] S1 = 125(502) S1 = 62750 … (1) Consider the second series, 5, 10, 15, …., 500 First term, a = 5 Common difference, d = 5 Let n be no of terms By nth term formula an = a + (n – 1)d 500 = 5 + (n – 1) 495 = (n – 1)5 n – 1 = 99 n = 100 Sum of an AP, Sn = (n/2) [ a + an] Let the sum of this AP be S2, S2 = S100 = (100/2) ×[5+500] S2 = 50(505) S2 = 25250 … (2) Consider the third series, 10, 20, 30, …., 500 First term, a = 10 Common difference, d = 10 Let n be no of terms an = a + (n – 1)d 500 = 10 + (n – 1)10 490 = (n – 1)10 n – 1 = 49 n = 50 Sum of an AP, Sn = (n/2) [ a + an] Let the sum of this AP be S3, S3 = S50 = (50/2) × [2+510] S3 = 25(510) S3 = 12750 … (3) Therefore, the required Sum, S = S1 + S2 – S3 S = 62750 + 25250 – 12750 = 75250 |
|