What’s the sum of all the digits used in writing out all the numbers from one to a billion?
| SelectClick for Answer> | |
|---|---|
Add 0 to the start of the list, and pad out each entry to 10 digits by prepending zeroes: 0000000000 0000000001 0000000002 0000000003 0000000004 ... 0999999996 0999999997 0999999998 0999999999 1000000000 Omit the final entry for the moment and pair the smallest entry in the remaining list with the largest, the second smallest with the second largest, and so on: 0000000000 + 0999999999 = 999999999 0000000001 + 0999999998 = 999999999 0000000002 + 0999999997 = 999999999 0000000003 + 0999999996 = 999999999 ... Each of these pairs produces the same sum, 999999999, the total of whose digits is 9 × 9 = 81. There are 500 million such pairs, so the sum of all those digits is 500,000,000 × 81, plus 1 from the last entry, 1,000,000,000, which we’d omitted above, giving a final total of 40,500,000,001. From Ross Honsberger’s More Mathematical Morsels, 1991. Allegedly the 10-year-old Carl Friedrich Gauss had used the same trick as a schoolboy.
| |