A file is locked with an integer password that is 1 digit long A file is locked with an integer password that is 1 digit long. Each time you guess an incorrect password, the password is changed randomly to an integer 1 digit longer than the previous password. The probability distribution of the password is uniform over all possible passwords (passwords are not allowed to have a leading digit of zero).
If $P$ is the probability you eventually guess the password correctly, what is the 20th digit of $P$ after the decimal point?
At first, I thought it should be like:

*

*Guessed correctly at the 1st trial: $\frac19$


*Guessed correctly at the 2nd trial: $\frac19 + \frac89 \times \frac1{90}$


*Guessed correctly at the 3rd trial: $\frac19 + \frac89 \times \frac1{90} + \frac89 \times \frac1{90} + \frac89 \times \frac8{90} \times \frac1{900}$
But then there is no patterns, so I think there is something wrong in my thought. Also, since the question is asking the 20th digit of $P$, I am guessing the answer should be maybe geometric series?
Is there any thoughts or advice on this? Appreciate your help!
 A: If $p_n$ is the probability you guess correctly at the $n$-th trial, we know that $p_1 = \frac{1}{9}$ and $p_{n+1} = (1-p_n)\frac{1}{9 \cdot 10^{n}}$.
So the $p_n$ that you're summing do not form a geometric series as the quotient of successive terms isn't constant.
But maybe this recursion will lead to a closed form for $p_n$ in terms of $n$ and a possibility to find a closed formula for the sum. But as the terms are decreasing rapidly, a small computer script (even bc -l on the Unix command line will do) will find the 20th decimal quite quickly. I don't know the course you're taking, but maybe that sort of approach is more warranted or feasible than the closed form approach.
A: It's easier to calculate it as the complement of the probability that you don't guess the password correctly:
$$1-\left(1-\frac{1}{9}\right)\left(1-\frac{1}{90}\right)\left(1-\frac{1}{900}\right)\ldots=1-\prod_{n=0}^\infty\left(1-\frac{1}{9\cdot10^n}\right)$$
But I don't know of any easy way to approximate the q-series without using a software. Wolfram alpha says that the digit you are looking for is 2.
