If we select a random integer number of the set $[1000000]$ what is the probability of the number selected contains the digit $5$? If we select a random integer number of the set $[1000000]$ 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 $[1000000]$" We need calculate $|E|$.
I know in $[100]$ 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 $[100]$
Then in $[1000]-[500]$ we have 171 numbers have the digit 5. this implies [1000] have 271 number contains the digit 5.
.
.
.
Following the previous reasoning we have to $[10000]$ have 3439 number contains the digit 5.
Then,  $[100000]$have 40951 number contains the digit 5.
Moreover, $[1000000]$ have 468559 number contain the digit 5.
In consequence the probability of we pick a digit contain the number 5 in the set $[1000000]$ is 0.468
Is correct this?
How else could obtain $|E|$?
Thanks

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.
