How many ones
All the integers from 1 to 1000 are written down in the usual way. How many times is the digit 1 written?
Fractions, decimals with at least 3 significant digits, and expressions such as sqrt(2)/2, e^-1 or pi/4.
Write the numbers from 0 to 999 with three digits each, padding with zeros: 007, 042, 315. Padding adds no ones.
In each of the three positions, how often does each digit appear?
h
s Shown after a correct answer. Revealing it first marks the problem as seen, not solved.
Idea. Pad the numbers from 0 to 999 to three digits. Then every position runs through all ten digits equally often, and counting becomes a matter of symmetry.
Step 1. The numbers 000 to 999 are 1000 strings of three digits. In each position, each of the ten digits appears in exactly of them.
Step 2. So the digit 1 appears times among 000 to 999. Padding only added zeros, and 000 is not in our list but contains no 1, so the numbers 1 to 999 contain 300 ones.
Step 3. The number 1000 adds one more: 301.
Variants. Each digit from 2 to 9 is written 300 times between 1 and 1000. From 1 to 1,000,000, the digit 2 is written times.