Suppose that a password for a computer system must have at least 8, but not more than 12, characters, where each character in the password is a lowercase English letter, an uppercase English letter, a digit, or one of the six special characters *, >, <, !, +, and =.

(a) How many different passwords are available for this computer system?

(b) How many of these passwords contain at least one occurrence of at least one of the six special characters?

My attempt:

lowercase = $26$ chances

uppercase = $26$ chances

digits = $10$ chances

characters = $6$ chances

$26 + 26 + 10 + 6 = 68$

$68^{12} - 68^8 = 21,381,376$ combinations.

Another attempt of mine, I dunno which is correct:

$${68\choose 12} - {68\choose 8} = 7,282,025,622,664 - 7,392,009,768 = 7.2746\times 10^{12}$$

• Can you justify why you took $68^{12} - 68^{8}$? Feb 23, 2014 at 10:06
• @martin For the b) question I would use your first attempt and without the special characters and then just what you got from a) - b). Feb 23, 2014 at 16:05

a) There are 68 characters. Can you justify why you took $68^{12} - 68^{8}$?
Your first approach would be nearly correct.

b) Hint: How many passwords do not contain one of the 6 special characters?

• i thought there are 68 characters and the lenght is between 8 and 12 so max is 12 68^12 and minus all the combinations before 8 length so we only get the between values. @Calvin Lin Feb 23, 2014 at 10:24
• @matin Note that we allow for passwords of length 8. How many passwords of minimum length 12 and maximum length 12 are there? Feb 23, 2014 at 10:28
• im really confused now :D we can only allow length 8-12 right ? if its less than 8 then not acceptable, more than 12 also the same... Feb 23, 2014 at 10:32
• @Matin try answering this different question using your logic: How many passwords have a minimum length of 12, and a maximum length of 12? Feb 23, 2014 at 10:37
• i guess it will be 68^12 ? Feb 23, 2014 at 10:39

I think should be like this 68^8+68^9+....+68^12=9.9207*10^21.

about the second question is that, it should be 9.9207*10^21-(62^8+62^9+....+62^12)=6.6415*10^21.

• Jun 13, 2014 at 17:11

You have choice of a string length 8, 9, 10, 11, or 12. The set of acceptable characters contains 68 possibilities. So the total number of possibilities for the 8-string is $68^8$, for the 9-string is $68^9$, so the total number of possible passwords is $\sum_{i=8}^{12} 68^i \approx 9.92\times10^{21}$

For the second question, the number of passwords that contain at least one of the six characters in the "special set" is the total minus those the contain none from that set. The total possibilities containing none from the special set can be calculated using a reduced character space of 62, and it would be $\sum_{i=8}^{12} 62^i \approx 3.28 \times 10^{21}$ so the number of passwords with at least one of character from the set is: $$\sum_{i=8}^{12} \left(68^i - 62^i\right) \approx 6.64\times 10^{21}$$

• Your summation formula is incorrect. You want $8 \le i \le 12$ and not $1 \le i \le 12$ as written. Jun 13, 2014 at 17:12
• Yup; good catch. The values are correct, but the indices were not. Thanks. Jun 13, 2014 at 17:13