Numbers with Nines

What proportion of all numbers less than a given size N have a 9 in their decimal expansion? A naive argument would be that, since 9 is one of ten distinct digits, the answer must be about 10%. But this is not “remotely close” to the true answer.

Counting the Nines

It is a simple counting exercise to determine the proportion of numbers less than 10 or 100 or 1000 for which at least one of the digits is a 9.

For N < 10 there is just one such number. For N < 100 there are 10 whose first digit is 9 and 9 others, making 19 in all. For N < 1000 there are 100 whose first digit is 9 and 9 by 19 others, making 271 in all. Here is a table of the number of numbers with at least one 9 digit:

NumbersWithNines

A Better Way

The above way of counting the 9s is a very awkward way of solving the problem. It is better to turn it around and ask what proportion of numbers less than a given limit have no 9s. Now it is simple to use a probabilistic argument.

Any given digit has a one-in-ten chance of being a 9. We consider all numbers less than 10N, which have N digits (counting leading 0s). Assuming the digits are chosen randomly, the chances of any particular digit not being a 9 are 9/10. The digits are independent so, for N digits, the chances of having no 9s are (9/10)N.

For a randomly chosen number less than one million (with six digits) the probability that there are no 9s is (9/10)6 = 0.531441. For numbers less than a billion, the chance decreases to 0.38742, well less than 50%.

Clearly, the probability (9/10)N becomes smaller, approaching zero as N increases. In that sense, “almost every number” has a 9.