Planet

Digit Frequency

During Numerion’s Great Census, animated digits line up and squabble in front of a census desk, while Liz breaks into a dance step

A flash, a jolt, and Kinesys lands on a mountain shaped like a 7. “Numerion, again,” Liz grumbles, improvising a dance step among the digits floating around her while she waits.

In the town square, the Great Census is underway: every digit on the planet demands to know how many times it gets written. The digits are squabbling, the 0 feels neglected, and the 1 is putting on airs. Dord is appalled: “A census done by eyeballing it? Impossible. This calls for an exact count.”

M00N eagerly volunteers as referee: “Let’s count together, so nobody gets offended!” The mayor hands them the official list: every number from 1 to 1,000.

The Riddle

Which digit appears most often in the numbers from 1 to 1,000 (inclusive)?

And which digit appears least often in those same numbers?

Hint

Count place by place (ones, tens, hundreds), and don’t forget the number 1,000. Watch out for zero: nobody writes 007 to mean 7.

Solution

The most frequent digit is 1, and the least frequent is 0.

In the numbers from 1 to 999, the digits 1 through 9 all appear the same number of times, because:

  • in the ones place, each digit appears once every 10 numbers, for a total of 100 times (for example, the digit 1 appears in 1, 11, 21, …, 991);
  • in the tens place (so from 10 up), each digit appears 10 times in a row in every block of 100 numbers, again for a total of 100 times (for example, the digit 1 appears in 10, 11, …, 19, then in 110, …, 119, and so on up to 910, …, 919);
  • in the hundreds place (so from 100 up), each digit appears 100 times in a row (for example, the digit 1 appears in 100, 101, …, 199).

Since the list also includes the number 1,000, the digit 1 appears once more than the digits 2 through 9: the digit 1 appears 301 times, while each of the digits 2 through 9 appears 300 times.

The digit 0, on the other hand, appears least of all, even though the number 1,000 contains three of them: in the tens and hundreds places, leading zeros are never written. Altogether, 0 appears 192 times in the numbers from 1 to 1,000: 100 times in the ones place, 91 times in the tens place, and once in the hundreds place.

The 0 accepts the verdict with dignity. The 1, meanwhile, celebrates for a week.