All the digits up to a million
Every integer from 1 to 1,000,000 is written down. What is the sum of all the digits written?
Fractions, decimals with at least 3 significant digits, and expressions such as sqrt(2)/2, e^-1 or pi/4.
Pad the numbers from 0 to 999,999 to six digits with leading zeros. That does not change the sum.
In each position, each digit from 0 to 9 appears equally often.
h
s Shown after a correct answer. Revealing it first marks the problem as seen, not solved.
Idea. With six-digit padding, the numbers 000000 to 999999 use every digit equally often in every position, so the sum is a simple count.
Step 1. There are padded strings of six digits. In each position, each digit appears times.
Step 2. The digits in one position add up to . Over six positions: Padding zeros add nothing, and 000000 contributes 0.
Step 3. Add the digit sum of 1,000,000, which is 1:
A pairing view. Pair with : the digits of the two numbers add up to 9 in every position, so each pair has digit sum 54. There are 500,000 pairs, giving again.