Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I create a $10$ digit password with the following requirements:

  • At least one uppercase letter A-Z - $26$
  • At least one lowercase letter a-z - $26$
  • At least one digits 0-9 - $10$
  • At least one common symbol $(\#,\$,\%,$ etc) - $32$

By inclusion-exclusion, I can calculate I have ~ $3.2333\mathtt E+19$ possible combinations

However, if I change one of the requirements to at least TWO digits 0-9, how can I calculate the possible combinations?

share|cite|improve this question
By inclusion-exclusion again. There are just more terms. – Qiaochu Yuan Aug 27 '10 at 4:04
You can take your previous answer, compute the number of passwords that had exactly one digit, and subtract it. – Arturo Magidin Aug 27 '10 at 16:09
So since there are 3.2333E+19 possible combinations remaining, and each of those has at least 1 digit, and the most digits it can have is 7, wouldn't the answer be 6/7's of the 3.2333E+19 = 2.77143E+19? – user1524 Aug 27 '10 at 19:11

You have to choose 10 letters, and 2 of them must be digits. Furthermore, there must be one each of a lowercase letter, an upper case letter, and a common symbol. For the others, there are 5 choices to be made, and these are to be made from $26+26+10+32 = 94$ characters.

This gives

$94^5 \approx 7.339e9$

choices for the the 6 other characters that do not have to be digits. And for the digits, there are 2 choices from 10 characters. So this gives

$ 10^2 = 100$

choices. And for the one each of lower-case letters, upper-case letters, and common symbols there are

$ 26 * 26 * 32 = 21632$


Now lastly, there are $10!$ permutations of these 10 characters, so the total number of combinations of these characters is:

$26*26*32*100*94^5 * 10! \approx 5.76e22$

share|cite|improve this answer
I'm confused by this method. I started with 94 possible characters with no restrictions as 94^10 = 5.38615E+19 total combinations possible, and then subtracted the restricted sets. This number is higher than my start point for some reason. – user1524 Aug 27 '10 at 19:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.