Solution
Digit Sum Marathon
Show the problem again
Find the sum of all the digits of all the integers from 1 to 999,999 inclusive. (For example, 1 to 12 contributes 1 + 2 + ... + 9 + 1 + 0 + 1 + 1 + 1 + 2.) Give an integer.
Worked solution
The answer is 27000000. Pad every number to six digits with leading zeros (this adds only zeros) and include 000000. The million strings 000000 to 999999 are all six-digit strings, so each position shows each digit 0 to 9 exactly $10^5$ times. Each position therefore contributes $10^5 \times 45 = 4{,}500{,}000$, and six positions give $27{,}000{,}000$. Pairing $n$ with $999999 - n$, whose digits are complementary (each pair of digits sums to 9), gives the same result: 500,000 pairs, each with digit sum 54.
Source: Classic exercise in wide circulation; no traceable original source. Statement written for AxiomIQ.