Discrete Mathematics
posted by Eric on .
It was proven during the previous lecture that
1+2+3+....+n=[n(n+1)]/2.
Using that result, find the sum of all 3digit palindromes: a palindrome is a number that can be written as ABA, where 1=<A<=9 and 0<=B<=9. Hint: decompose ABA = 100*A + 10*B + A and use above proven result.

Note that A can vary from 1 to 9, while B can take on the digits 0 to 9.
Sum of first and third digits:
So for each value of A=a(i), the sum is 100a(i)+a(i)=101a(i).
For the 9 values of A, we have a sum of
101Σi for i=1 to 9.
Since each value of a(i) can be matched to 10 values of B, the above sum has to be multiplied by 10 to give
1010Σi for i=1 to 9.
Sum of the second digit (B)
Each digit of B is in the 10 position, so we need to multiply by 10.
The sum of the digits 09 are repeated 9 times for each value of A, so the sum of digits B is
9*10Σi for i=0 to 9
=90Σi for i=0 to 9
Finally, add up the two sums:
1010Σi for i=1 to 9.
+
90Σi for i=0 to 9
to get the total