Monday, July 03, 2006

Problem Solving - 4

What is the sum of all three digit positive integers, the sum of whose digits is a multiple of 3?

a) 900

b) 165150

c) 165000

d) 329199

e) 328900

Answer - B

Sum of n numbers = n/2(2a+(n-1)d)

We want to add the numbers from 102 to 999 that are divisible by 3.

We divide by 3 to get 34 to 333, or 300 numbers in total.

Here n = 300, a = 34, d= 1

Sum = 1/2*300*(333+34) = 150 * 367 = 55,050

Multiplying by 3 again gives 165,150 .

TIP

To add the first n integers from 1 to n
add together 1 + n = n+1
then 2 + (n-1) = n + 1 until you get to n/2 (depending on whether n is odd or even)
Ultimately we have n/2 pairs that all add up to (n+1)
So the sum is 1/2 * n * (n+1)
If you don't start at 1, or have a gap of more than 1 --- slightly adjust the formula.