TITLE: Password combinations help
QUESTION [5 upvotes]: I've been looking through other posts here about combinations/permutations regarding possible numbers of passwords for a given set of rules, but I can't get my head around it and wondered if someone could help me.
I have an example in mind for a password problem. So, how many valid passwords are there if:
The password must be exactly 6 characters long.
The password can only contain lowercase letters (a to z) and digits    (0 to 9).
The password must contain 4 letters and must contain 2 digits.
Digits can't be repeated
Letters can be repeated
So I thought the answer would be:
P(6,2) x 10 x 9 x 26^4
P(6,2) I've calculated as:
6! / (6 - 2)! = 30
So final answer: 30 x 10 x 9 x 26^4
Is this right? Or should I be using combinations? Honestly I've been looking on here for ages and reading through different answers and inclusion/exclusion but I can't figure it out so I'd really appreciate someone walking through it.
Thanks

REPLY [3 votes]: It is almost correct. You first decide which "slots" to put the 2 digits in an array of 6 positions, that is ${6 \choose 2}$, then you fill the digit slots with non-repeating digits, that is $10\cdot 9$, and finally you fill the 4 character slots with any possible combination, that is $26^4$.
You computed the combinations wrong though, it is ${n\choose k} = \frac{n!}{k!(n-k)!}$, so the total number of possible passwords is ${6 \choose 2}\cdot 10\cdot 9\cdot 26^4 = 616917600$.