Copyright © University of Cambridge. All rights reserved.

'Digit Sum' printed from https://nrich.maths.org/

Show menu


The problem was "What is the sum of all the digits in all the integers from one to one million?" and it was not intended to be a long hard grind doing lots of adding up.


The very first solution of the month came from Joshua from Russell Lower school in Ampthill, Beds. He took three days to come up with a solution done the hard way. His method was well thought out, and very clearly explained, and his answer was so nearly correct that we even suspected a typo in the answer he gave. No-one else sent in an answer as close as Joshua's.


The hint was "Take your partners and leave the big one to stand alone". Well the big one is of course one million but if he stands alone then there are an odd number of players in this game (1 to 999,999) and you have to bring in an extra in order that each has a partner.

This is the secret, bring in zero who won't add up to much! Take 0 with 999,999, then 1 with 999,998, then 2 with 999,997 , 3 with 999,996 and so on. There are altogether half a million, that is 500,000, pairs of numbers.

Adding the two numbers in each pair requires no carrying because, in each place (units, tens, hundreds places etc.) the digits add up to 9. The digits in each of these pairs add up to 54 (equal to 9 x 6) and then there is the number 1,000,000 which stands alone. You can now work out the sum of the digits in your head, it is

500,000 x 54 + 1 = 27,000,001

You can find more short problems, arranged by curriculum topic, in our short problems collection.