WB gave the method of obtaining the correct answer it in the first post.

The formula is:

f(n) = (f(n-1)*9 + 1)/10 where f(n) is the percentage of numbers out of 10^n that contain any non-zero digit.

The formula is simply a weighted average: 1/10 of 10^n will be have the digit in 100% of its numbers and the other 9/10 will have it in (f(n-1)*100)% of its numbers. (Visualize it the 10 blocks).

You can create a spreadsheet to quickly find the trend.

f(100) = 0.999973439...That means that almost 100% of all the numbers less than a googol contain at least one 3.

Note: If the question is "What percentage of ALL numbers contain at least a 3?", the answer isn't "close to but never 100%", its exactly 100%.

This is because the "ALL" makes the formula lim

_{n->∞}f(n), which is 1.

While this might not make sense (because you can list out numbers that don't contain a 3), it still is the correct answer. The reason is you're trying to take a percentage of a percentage of infinity, which isn't a number.

**Edited by vinays84, 22 April 2009 - 10:20 PM.**