Someone on the internet asks:

What percentage of the natural numbers have the digit 'seven' in them?

This is going to sound like a weird answer: it's 100%.

I know, I know: you can point at 42 and 100 and 986,543,210 and 666,666,666,666,666 and at least a handful of others - so surely 100% can't be right?

(As an aside: you can reasonably say that there are as many 'seven-free' numbers as there are 'sevenful' ones as there are infinitely many of both - but we're not going to get into cardinality and Cantor and all that here - another day!)

I'm going to show that, the further you go in the natural numbers, the smaller the proportion of seven-free numbers.

### The first thousand and the first million

In the first thousand numbers - 000 to 999 - 90% of them have a non-seven first digit; 90% of those have a non-seven second digit; and 90% of *those* have a non-seven final digit. That works out to $1000 \times 0.9 \times 0.9 \times 0.9$ or $1000 \times 0.9^3 = 729$ seven-free numbers in the first 1000. That's quite a lot! Only 27% or so are sevenful.

If you go up to a million, though - six-digit numbers - you're looking at $1,000,000 \times 0.9^6 = 531,441$ seven-free numbers; almost 47% are now sevenful.

In general, you can work out that there are $9^n$ seven-free numbers in the first $10^n$ natural numbers, and the proportion of seven-free numbers is $0.9^n$. The bigger $n$ gets, the smaller that number is -- if $n = 100$, only about 1 in 38,000 numbers are seven-free - the remainder all have a seven somewhere.

### The dice argument

This is similar - more or less equivalent, in fact - to the argument that if you roll a ten-sided die enough times, eventually you'll get a seven. The probability of you avoiding the seven is smaller the more times you roll the die - and if you roll forever, you will almost surely throw a seven.

You can, if you like, use logarithms to figure out how many digits you would need if you wanted the probability of being seven-free to be less than any number ($\epsilon$, traditionally) you want - but since WordPress has already eaten this post once, I'll leave it as an exercise for the interested reader.

## Colin

Colin is a Weymouth maths tutor, author of several Maths For Dummies books and A-level maths guides. He started Flying Colours Maths in 2008.
He lives with an espresso pot and nothing to prove.