# Number of passwords - no repeated numbers

Am currently studying for a discrete math exam and I'm having problems with the following question:

Q: How many 8 character passwords can be created from the 26 letters of the alphabet(a-z) and the 10 digits (0-9) that don't contain repeated numbers?

The thing which is throwing me here is that I can repeat letters but not numbers.

My solution is to add the possible combinations from each of cases where the password has 0, 1, 2, 3, 4, 5, 6, 7, 8 numbers, so:

$Total = 26^8 + 26^7{10\choose 1}+ 26^6{10\choose 2}+ 26^5{10\choose 3} + 26^4{10\choose 4}+ 26^3{10\choose 5}+ 26^2{10\choose 6}+ 26^1{10\choose 7} + {10\choose 8}$

However this seems pretty long-winded and I'm not sure if its correct. Am hoping someone can help?

• This is close, but not quite right. The number you calculated is the number of 8 character passwords with possibly repeated letters but no repeated numbers where the numbers (if any) always occur at the end of the password in order from least to greatest. Take a look at $26^4\binom{10}{4}$ for example. The $26^4$ corresponds to which four letters you pick and the order of selection mattering. The $\binom{10}{4}$ corresponds to picking four numbers where order doesn't matter. You did not account for which spaces the numbers take nor did you account for which order they appear. – JMoravitz Oct 30 '16 at 0:48
• For four numbers, recommend multiplication principle: pick which four of the eight spaces are taken by numbers, from left to right in the spaces reserved for numbers pick a number to fill that space, from left to right in the spaces reserved for letters pick a letter to fill that space. Repeat this argument for each of the other possible cases. – JMoravitz Oct 30 '16 at 0:51

This is almost correct. You've counted all possible orders of letters but only the ways to choose numbers. As a result, we have to count all possible orderings. Additionally, as JMoravitz explains above, we need to count all the ways to intersperse numbers and letters.

Take the fourth term in your sequence, where we have 5 possibly-repeating letters and 3 distinct numbers: $26^5 {10 \choose 3}$. We need to consider all ways to order the 3 numbers ($3!$) and the ways to pick slots for numbers. Of 8 total characters, 3 are numbers: ${8 \choose 3}$. Thus, we have

$$26^5 {10 \choose 3} 3!{8 \choose 3}$$

We then have our final expression.

$$\sum_{i=0}^8 26^{8-i} {10 \choose i} i! {8 \choose i}$$

Note that we can simplify this expression a bit by instead considering that for $i$ slots, we have 10 options for the first slot for numbers, 9 for the second slot for numbers etc. Then, we have

$$\sum_{i=0}^8 26^{8-i} \frac{10!}{(10-i)!}{8 \choose i}$$

*You could convince yourself that both expressions are equivalent by expanding ${n \choose k} = \frac{n!}{k!(n-k)!}$.