What is the sum of the digits of all numbers between 1 and a million?
NOTE: The numbers 1 and 1 million should be included.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Let's start simple.
Write the digits from 1 to a million as
1 , 2 , 3 , 4 , … … , 9 9 9 9 9 6 , 9 9 9 9 9 8 , 9 9 9 9 9 9 , 1 0 0 0 0 0 0
What I do is that I add a 0 before 1
Hence our sequence now looks like
0 , 1 , 2 , 3 , … … , 9 9 9 9 9 6 , 9 9 9 9 9 7 , 9 9 9 9 9 8 , 9 9 9 9 9 9 , 1 0 0 0 0 0 0
Then I add the numbers in pairs in this way -
9 9 9 9 9 9 + 0 9 9 9 9 9 8 + 1 9 9 9 9 9 7 + 2 . . . = 9 9 9 9 9 9 = 9 9 9 9 9 9 = 9 9 9 9 9 9
In this way, we see that we get the same number 9 9 9 9 9 9 as the sum of the pairs. Note that this method does not change the sum of the digits of the numbers since we never add any two digits whose sum is greater than 9 .
Now the number 9 9 9 9 9 9 has been repeated half a million times so the sum of all of the digits of the numbers from 1 to 9 9 9 9 9 9 is 9 × 6 × 5 0 0 0 0 0 = 2 7 , 0 0 0 , 0 0 0 .
But the 1 in 1 0 0 0 0 0 0 hasn't been added. After adding it we get the sum as 2 7 , 0 0 0 , 0 0 1 .