On Yahoo Questions on July 9, 2011 Raviyank Patel asked:
If S is the sum of all the digits of the natural number N = 1+11+111+1111+ ....to 2011 terms, then the sum of the digits of S is ? thank you.
  1. 17
  2. 18
  3. 19
  4. 21
Here is my response:

First I had to use a little bit of brute force to get me started thinking and establish a pattern. I decided to look at the same problem, but with a smaller number of terms. After doing that it was easy to establish that in general for n terms, you would have , since you are just counting the number of 1's that you are adding in each place value position. If you use a bit of brute force for some small values of n it won't take long to notice a pattern. Note, that I decided to focus on numbers of terms that are multiples of 3 plus 1, because 2011 = 3(670)+1
number of termsNSSum of digits of S

Okay, I admit it, after 16 terms, I was no longer using brute force, but I was using the pattern that I saw emerging. Once you see that pattern, then you can see that for the part that repeats: 234,567,901 the digits add to 37. Add the leading 1 and the leftover digits on the end and you get S. So for 2011, there are 670/3= 223 with remainder 1. That means for 2011 terms, N = 1,234,567,901,...,234,567,901,233 with the 234,567,901 part showing up 223 times. Hence S=(37)(233)+2+3+3+1= 8630, so sum of S's digits = 17