# How many passwords are possible in this scenario?

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?

• for one 1 char passwords, one can only put $$26$$ different characters
• for one 2 char passwords, one can only put $$26^2$$ different characters
• for one 3 char passwords, one can only put $$26^3$$ different characters
• ...
• for one 8 char passwords, one can only put $$26^8$$ different characters

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;

• Assume that the alphabet has $$l$$ letters,
• $$m$$ numerals, and
• $$p$$ non-alphanumeric.

If we set the passwords to require at least;

• $$n_m$$ numerals
• $$n_p$$ non-alphanumeric,with
• passords's length to $$min \geq n_k+n_a \geq 6,\text{and}$$
• $$max > min$$, then

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;

• $$6 \text{ then } S = 178928$$
• $$7 \text{ then } S = 10013424$$
• $$8 \text{ then } S = 10013424$$
• $$9 \text{ then } S = 560745200$$
• $$10\text{ then } S = 31401724656$$ is 35-bit.

WolframAlpha calculator;

m^{n_m} + p^{n_p} + sum (l+m+p)^i, i=1 to (max - (n_m + n_p))

• can you please , add some explaination ? – uma Oct 6 '18 at 16:36

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.

• this is not a homework . but it was question , i had read in past paper. i have to verify my answer is correct or wrong and build some discussion. this is more related to math,that is why , i expect some help . :) – uma Oct 6 '18 at 16:46
• math.stackexchange.com/questions/739874/… – kelalaka Oct 6 '18 at 16:47
• @kelalaka thank you.i think that is better place to this question. – uma Oct 6 '18 at 16:49