# If we select a random integer number of the set $$ what is the probability of the number selected contains the digit $5$?

If we select a random integer number of the set $$ what is the probability of the number selected contains the digit $5$?

My work:

We know the sample space $S:$"The set of number of 1 to 1000000" and $|S|=1000000$
Let $E$ the event such that $E:$"The set of number contains the digit 5 in $$" We need calculate $|E|$.

I know in $$ we have $5,15,25,35,45,50,51,52,53,54,55,56,57,58,59,65,75,85,95$ then we have 19 numbers contains the digit $5$ in the set $$

Then in $-$ we have 171 numbers have the digit 5. this implies  have 271 number contains the digit 5.

. . .

Following the previous reasoning we have to $$ have 3439 number contains the digit 5.

Then, $$have 40951 number contains the digit 5.

Moreover, $$ have 468559 number contain the digit 5.

In consequence the probability of we pick a digit contain the number 5 in the set $$ is 0.468

Is correct this?

How else could obtain $|E|$?

Thanks

• I assume you mean $1$ to $1000000$? – Remy Mar 28 '18 at 20:32
• Yes is that @Remy – Bvss12 Mar 28 '18 at 20:33
• Among the integers $\{0,1,2,3,\dots,999999\}$ there are $9^6$ numbers without any $5$'s. Can you see why? Adjusting and looking instead at $\{1,2,3,\dots,1000000\}$ it remains $9^6$ don't have a $5$. – JMoravitz Mar 28 '18 at 20:34
• I think you take the complement, no? @JMoravitz – Bvss12 Mar 28 '18 at 20:35
• Temporarily allow leading zeroes to be considered and count how many six-digit strings there are using digits $\{0,1,2,3,4,6,7,8,9\}$. Apply rule of product with the steps "pick the first digit", "pick the second digit", etc... – JMoravitz Mar 28 '18 at 20:37

Notice that $P(\text{contains 5})=1-P(\text{doesn't contain 5})$. The latter is easily calculated by calculating the probabilities that each individual digit is not 5. Hence,
\begin{align} P(\text{doesn't contain 5})&=\left(\frac{9}{10}\right)^6\\ &=\frac{531441}{1000000} \end{align} and \begin{align} P(\text{contains 5})&=1-P(\text{doesn't contain 5})\\ &=1-\frac{531441}{1000000}\\ &=\frac{468559}{1000000} \end{align} which corresponds with the answer you got.