# Sum of digits of numbers from $1$ to $10^n$

Without using a calculator, what is the sum of digits of the numbers from $1$ to $10^n$?

Now, I'm familiar with the idea of pairing the numbers as follows:

$$\langle 0, 10^n -1 \rangle,\, \langle 1, 10^n - 2\rangle , \dotsc$$

The sum of digits of each pair is $9n$. How can I prove this property retains for all pairs?

• I was able to explain it to myself with some hand-waving. I admit I gave up too quickly though. – deficiencyOn May 10 '18 at 12:57
• @user477343 The pairing of numbers is apparently an important step made by OP. This is reflected by the no. of upvotes (s)he received. – GNUSupporter 8964民主女神 地下教會 May 10 '18 at 12:58
• Okay never mind. It's actually a straight forward explanation (should I delete this post?) – deficiencyOn May 10 '18 at 13:00
• Please don't. This is an interesting problem. – GNUSupporter 8964民主女神 地下教會 May 10 '18 at 13:00
• @deficiencyOn Your question got some upvotes, so that might indicate some interest of people in the question (and answer of course!). But you can actually post the answer to your own question yourself; that's not an uncommon thing to do. – Bram28 May 10 '18 at 13:01

Well, it's not too hard to figure out that the sum of digits of 0 or 1 to 9 is 45. That's very helpful, since that sequence will appear a bunch. Just add 1, and 46 is the sum of digits from 1 to 10 (or 0 to 10).

In a way, that and the base shifts are all you need I believe. Let's do 100. We're going to get 10 times 45 in the ones place, for all of the numbers. As for the tens place, it moves ten times slower - but they all still pair up ten times to make 45 (try doing 10 with 20 with 30, 11 with 21 with 31, etc). so the sum from 1 to 99 is 450 + 450 = 900, and then add 1 + 0 + 0 to get 901.

In general, it should be $45n 10^{n - 1} + 1$, by the reasoning I have described.

• Very nice approach (the most direct one I guess, in terms of arithmetic). Thanks! – deficiencyOn May 10 '18 at 13:15
• @deficiencyOn It was also off by a factor of ten, because I forgot to take off 1 in the exponent. It's been corrected. – theREALyumdub May 10 '18 at 13:29

There is a constant pattern of nos. I will demonstrate it for 2 digit nos.
00 01 02 03 04 05 06 07 08 09
10 11 12 13 14 15 16 17 18 19
20 21 22 23 24 25 26 27 28 29 and it goes so on.

You can make a pattern of numbers for any digit nos.
Just add $0s$ before a number to make it of n-digit. Now due to this symmetrical pattern, all nos. 0,1,2,3,4. . . will be in equal amount.

From $0000$ till $9999$ we have $10\,000$ four digit words. The $40\,000$ digits have an average value of $4.5$ each. Add $1$ for the extra number $10\,000$ and obtain $180\,001$.

• Because all digits appear with the same frequency. – Yves Daoust May 10 '18 at 13:41

Okay so the truly simple explanation is merely the fact that all those pairs sum to $999$ (i.e. in the case 0f $n=3$) . There's nothing more than that. In more details, one can see that this property is true for the first pair. Inductively, the next pair is made by increasing the first item by $1$ and decreasing the second by $1$, and so maintaining this property.