What do we get if we add the digits of the integers from 1 to 99?
Question
The function S(n) is defined for positive integers n by S(n)=sum of the digits of n. For example, S(723)=7+2+3=12. The sum S(1)+S(2)+S(3)+⋯+S(99) equals
- 746,
- 862,
- 900,
- 924.
Suggestion
Could we lay out the S values in a table?
How often does the digit 1 appear in the numbers from 1 to 99?
What about the other digits?
Solution
Approach 1
We can lay out the digits we have to add in a table and then add up each column.
| 0+0 | 0+1 | 0+2 | 0+3 | … | 0+9 |
|---|
| 1+0 | 1+1 | 1+2 | 1+3 | … | 1+9 |
| 2+0 | 2+1 | 2+2 | 2+3 | … | 2+9 |
| … | … | … | … | … | … |
| 9+0 | 9+1 | 9+2 | 9+3 | … | 9+9 |
| 1+2+⋯+9=45 | 45+10×1 | 45+10×2 | 45+10×3 | … | 45+10×9 |
Adding up the column totals we have 45×10+10×1+10×2+⋯+10×9=45×10+10×45=900 so the answer is (c).
Approach 2
Since zeroes do not contribute to the sum, we can rewrite this as S(1)+S(2)+S(3)+⋯+S(99)=S(00)+S(01)+⋯+S(99).
Then in the 100 two-digit numbers 00,…,99, each digit 0,…,9 appears 20 times (10 times as the first digit, 10 times as the second).
So S(1)+S(2)+S(3)+⋯+S(99)=20×(0+1+⋯+9)=20×10×2(0+9)=900, and the answer is (c).