Finding the distribution of number of attempts needed to guess a password of 8 characters So the problem is the following:
Find the distribution of $X$ defined to be the random variate equal to the number of attempts needed to find a password of length 8 composed uniquely of characters in $A = \{a,.., z, A,.., Z, 0,..,9\}$.
I tried to solve it(tldr; answer at the end) but I find a result that doesn't depends on the number of attempts precised in the distribution function of $X$ I found, and I'm suprised by that.
Now there is $n = \#(A^8) = (26 \times 2 + 10)^8 = 62^8$ possible passwords. And, in this problem, I assumed that elements of $A^8$ were all equally likely to be one's choice of password.
first define $B_k = $ set of elements that reveiled themselves not being the password in our k first attempts to guess the password. 
The method used for finding the password is:
if at the beginning of the $k^{th}$ attempt we didn't find the password yet then
take at random one element $a_k$ of the set $A^8 \setminus B_{k-1}$, and  check if $a_k$ is the password. 
else stop(found the password at previous attempt!).
I then proceeded to finding the density of probability for $X$:
Let $a_k$ be the element taken from the set $A^8 \setminus B_{k-1}$ that we're going to match against the password to check if $a_k$ is the real password.
And let $I_k$ be the event: "$a_k$ is the password".
\begin{align} 
Pr \{X = k\} =& Pr \{I_k \cap \bar I_{k-1} \cap ... \cap \bar I_1\} \\
             =& Pr \{I_k | \bar I_{k-1} \cap ... \cap \bar I_1\} \times
                         Pr \{\bar I_{k-1} | \bar I_{k-2}\cap ... \cap \bar I_1\} \times  ... \times Pr\{\bar I_1\}
\end{align}
now it seems to me that since every elements of $A^8$ is equally likely to
be the password:
\begin{align}Pr \{I_k | \bar I_{k-1} \cap ... \cap \bar I_1\} =
\frac{\#\text{ of elements in }A^8 \setminus B_{k-1} 
\text{ that are the password}}{\# (A^8 \setminus B_{k-1})} = 
\frac{1}{\#A^8 - \#B_{k-1}} =
\frac{1}{62^8 - (k-1)}
\end{align}
and that 
\begin{align}Pr\{\bar I_i | \bar I_{i-1} \cap ... \cap \bar I_1 \} = &
\frac{\#\text{ of elements in }A^8 \setminus B_{i-1} 
\text{ that aren't the password}}{\# (A^8 \setminus B_{i-1})}\\ =&
\frac{(\#A^8 - \#B_{i-1}) - 1}{\#A^8 - \#B_{i-1}}\\ =&
\frac{(62^8 - (i-1)) - 1}{62^8 - (i-1)}\\ =&
\frac{62^8 - i}{62^8 - (i-1)}
\end{align}
then 
\begin{align}
Pr\{X = k\} = \frac{1}{62^8 - (k-1)} \times \frac{62^8 - (k-1)}{62^8 - (k-2)} \times \frac{62^8 - (k-2)}{62^8 - (k-3)} \times \cdots \times \frac{62^8 - 1}{62^8}
\end{align}
we see that a denominator always cancels the closest numerator to its right
and we get that 
\begin{align} Pr\{X = k\} = \frac{1}{62^8} \end{align}
but it just seems so weird to me that no $k$ appears in the result to me.
I'm pretty sure I've done something wrong, could someone help me?
Many thanks.
 A: Let's make it really simple.  Suppose the search space consists of the integers $\{1, 2, \ldots, n\}$, and one member $P \sim \operatorname{DiscreteUniform}(1,n)$ is chosen from this space at random with equal and uniform probability, as the password.  The strategy is to successively guess $g_i = i$ for $i = 1, 2, \ldots, n$, until we encounter the randomly chosen number.  Therefore, the probability we are correct on the $k^{\rm th}$ try is $$\Pr[X = k] = \sum_{j=1}^n \Pr[X = k \mid P = j] \Pr[P = j].$$  Since $\Pr[P = j] = \frac{1}{n}$ and $$\Pr[X = k \mid P = j] = \begin{cases} 0, & k \ne j \\ 1, & k = j \end{cases} \; = \mathbb{1}(k = j),$$ we simply have $$\Pr[X = k] = \frac{1}{n}.$$  That is to say, the probability distribution remains discrete uniform on $\{1, 2, \ldots, n\}$.
Note that this should be intuitive:  the only strategy to adopt is to ensure that no previously guessed password, if incorrect, is guessed again.  After that, it makes no difference whether we regard the guessing as sequential and the true password selected randomly, or if the password is selected deliberately and the guessing is random (without replacement).
Consequently, if the strategy of going through sequentially is the same no matter which password is chosen, and each password is equally likely to be chosen, then we obviously would expect that $1/n$ of the time, password $k$ is chosen, with the result that it will take exactly $k$ guesses to reach that choice, hence the distribution of the number of guesses will be the same as the distribution for how the password was chosen.
A: Assuming that one will take previous attempts into account:


*

*$P(X=1)=\frac{1}{62^8}$

*$P(X=2)=\left(1-\frac{1}{62^8}\right)\cdot\left(\frac{1}{62^8-1}\right)$

*$P(X=3)=\left(1-\frac{1}{62^8}\right)\cdot\left(1-\frac{1}{62^8-1}\right)\cdot\left(\frac{1}{62^8-2}\right)$

*$\dots$

*$P(X=n)=\left(\prod\limits_{k=0}^{n-2}1-\frac{1}{62^8-k}\right)\cdot\left(\frac{1}{62^8-n+1}\right)$



Assuming that one will not take previous attempts into account:


*

*$P(X=1)=\frac{1}{62^8}$

*$P(X=2)=\left(1-\frac{1}{62^8}\right)\cdot\left(\frac{1}{62^8}\right)$

*$P(X=3)=\left(1-\frac{1}{62^8}\right)\cdot\left(1-\frac{1}{62^8}\right)\cdot\left(\frac{1}{62^8}\right)$

*$\dots$

*$P(X=n)=\left(1-\frac{1}{62^8}\right)^{n-1}\cdot\left(\frac{1}{62^8}\right)$

