Counting the Ones

  • Medium
  • Number puzzles
  • Tests: Counting a digit by position

The puzzle

You write out all the whole numbers from 1 to 100 in a long list.

How many times do you write the digit 1? Note that 11 counts twice.

Stuck?

One at a time, smallest first. Open only as many as you need — the whole point of the puzzle is the part you work out yourself.

Hint 1

Count the units position and the tens position separately, then deal with 100.

Hint 2

A 1 in the units place happens once every ten numbers.

Show the answer Hide the answer

21 times.

How to get there

Units position: 1, 11, 21, 31, 41, 51, 61, 71, 81, 91 - ten numbers have a 1 in the units place.

Tens position: 10 through 19 - another ten. These are different occurrences, which is why 11 is counted in both lists and correctly contributes two.

Then 100 contributes one more 1. Total: 10 + 10 + 1 = 21. Counting by position avoids the usual error of listing "numbers containing a 1" and getting 20, which undercounts 11 by one.

The technique worth keeping

Count occurrences by digit position, not by number. Each position is an independent, regular pattern, and summing them counts repeated digits the right number of times automatically.