[Math] Show how the probability that an 8 character password contains exactly 1 OR 2 integers is .630

combinationscombinatoricsprobability

A password is 8 characters long. Each character can contain 26 lower case or 26 uppercase letters or a integer from 0-9. What is the probability that an 8 character password contains exactly 1 OR 2 integers?

Please explain as the book answer is P = .630

Assuming that I could use (52^6*10^2+52^7*10)/62^8 was incorrect. This is the sum of the product between the possibilities of having one integer in the password and having two integers in the password; 62^8 is the total possibilities given each character can be a lower/uppercase or integer.

Best Answer

Hint: The number of passwords with exactly $2$ digits is $\binom{8}{2}(10^2)(52^6)$.

This is because the locations of the $2$ digits can be chosen in $\binom{8}{2}$ ways. For each of these ways, the $2$ chosen locations can be filled with digits in $10^2$ ways. And for each of these ways, the remaining $6$ slots can be filled with letters in $52^6$ ways.

Your calculation did not take into account the fact that there are quite a few choices for the location of the two digits.