# How can I calculate the number of potential combinations in a password?

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.2333E+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?

-

4
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

## 1 Answer

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$

choices.

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$

-

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
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 6, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.8911526203155518, "perplexity_flag": "middle"}