What’s the chance of a random whole number between 1-999 having the digit 9 in it? (or number of whole numbers with 9)

combinatoricsprobability

I've thought about this problem the following way. If this was represented by 3 dials which have number 0-9 in them ([0-9][0-9][0-9]) then the chance of hitting 9 in one of them is 1/10. Since there are 3 dials it's 3 * 1/10 = 3/10.

Hence the number of whole numbers between 0-999 having having the digit 9 is 999 * 0.3 = 299.7 (or 300).

Have I done a mistake in my way of calculation and way I've visualised the problem? And why does it result in a number which isn't whole (299.7)?

Best Answer

Let us first calculate number of whole numbers from 1 to 999 , which don't have the '9'.

This is given by (9 times 9 times 9)-1 =728.

Therefore ,number of whole numbers which do have 9 in them is given by , 999-728= 271.

Therefore , the probability of getting a whole number from 1 to 999 which does have '9' is given by $\frac{271}{999}=0.271$