Containing a one
Imagine all the positive integers in the range 1-1,000,000,000 (inclusive).
How many of these numbers contain the digit ‘1’ in some location?
For example 43,252,003 does not, but 980,107 and 98,111,787 do. Take a guess before thinking about it.
Solution
To find out how many contain, at-least, one occurrence of ‘1’, we can work out the complement; how many contain no occurrences and subtract this from the total. If we consider that every positive number less than 1,000,000,000 is a nine digit number (prepending zeros, as necessary, to pad it out), then each of these digits can be one of the nine possible digits in the set [0,2,3,4,5,6,7,8,9] so there are 99 combinations. However, there is a special case when every single digit is zero, and this is not valid, so we need to subtract for this case, so the answer is 99-1 = 387,420,488
This means that the number that do contain the digit ‘1’ is 1,000,000,000-387,420,488=612,579,512 which as a percentage is ≈ 61.258%
This is a higher percentage than my initial gut feel!
The percentage of the first billion numbers that contain the digit ‘1’ ≈ 61.258%
Advertisement:
Bigger Numbers
What happens if we use a different number? 1,000,000,000 = 109, let’s look at how things change for 10n
n | 9n - 1 | 10n | Percentage | |
---|---|---|---|---|
1 | 8 | 10 | 20.000% | |
2 | 80 | 100 | 20.000% | |
3 | 728 | 1,000 | 27.200% | |
4 | 6,560 | 10,000 | 34.400% | |
5 | 59,048 | 100,000 | 40.952% | |
6 | 531,440 | 1,000,000 | 46.856% | |
7 | 4,782,968 | 10,000,000 | 52.170% | |
8 | 43,046,720 | 100,000,000 | 56.953% | |
9 | 387,420,488 | 1,000,000,000 | 61.258% | |
10 | 3,486,784,400 | 10,000,000,000 | 65.132% | |
11 | 31,381,059,608 | 100,000,000,000 | 68.619% | |
12 | 282,429,536,480 | 1,000,000,000,000 | 71.757% | |
25 | 717,897,987,691,852,588,770,248 | 10,000,000,000,000,000,000,000,000 | 92.821% | |
50 | 950-1 | 1E+50 | 99.485% | |
100 | 9100-1 | 1E+100 | 99.997% |
As n gets larger:

We can see that, as the size of the number gets bigger, a higher, and higher concentration of the numbers contain the digit ‘1’ (or any other digit).
At primary school, we used to play a game called “Buzz”, where we would go around the classroom incrementing numbers 1, 2, 3 … but there would be a magic number of the day (say “5”), and instead of saying a number that contained that digit, you would say “Buzz”. 1, 2, 3, 4, Buzz, 6, 7, 8, 9, 10, 11, 12, 13, 14, Buzz, 16, 17 … You can see that if you played this game for a loooong time, it would become very boring.