A password string consists of one or more of the 26 characters A..Z and can be of any length from $1$ to $8$ characters. How many password are possible in this scenario?
- As my calculation, it should be $2^{26}\times8!$, is it correct?
In short, think each box can contain how many letters from the given alphabet and multiply the values in the boxes. Finally, sum them.
$$\sum_{i=1}^8 26^i = \frac{26^9-1}{26-1}-1$$
The name of the formula is Sum of Consecutive powers of a number;
$$\sum_{i=0}^n a^i = \dfrac{a^{n+1} -1}{a-1}$$
and $-1$ since $i=0$ is not a case here.
Update : a more general case;
Let assume that you want to build a web application and want to determine the security level of the passwords. Here a calculator;
If we set the passwords to require at least;
What is the password space, $\mathcal{S}$?
$$ \mathcal{S} = m^{n_m} + p^{n_p} + \sum_{i=1}^{max - ({n_m} + {n_p})} (l+m+p)^i$$
Under these assumptions, let
$l = 26$
$m = 10$
$p = 20$
$min = 6$
$max=20$
$n_m=2$
$n_p =1$, then we have;
$$ \mathcal{S}_{6:20} = 10^2 + 20 + \sum_{i=1}^{17} (56)^i = 533361663473057950558105648760 $$
$ \mathcal{S}_{6:20}$ has 99 digits in binary form.
if max is;
WolframAlpha calculator;
m^{n_m} + p^{n_p} + sum (l+m+p)^i, i=1 to (max - (n_m + n_p))
No, it is incorrect. As I assume this is homework. I won't supply a full answer.
$2^{26}$ suggests 26 binary choices. But that is not the case.
$8!$ would suggest an arbitrary ordering of 8 characters.
What you have is the 8 different lengths, you can sum the number of combinations for each length.
Note letters can repeat themselves; you can select letters independently.