# Number of 6-character passwords with at least 1 digit

I have two methods for calculating the answer to a problem, and I'm unable to figure out where one of them goes wrong (they yield different values).

My question is, why is this the case? Am I doing something wrong in my calculation, or my logic?

In my class today the professor discussed how to calculate the number of password combinations under the following conditions:

• The password is 6 characters long
• The password contains only upper-case letters and digits
• The must be at least 1 digit in the password

His solution was to take the total combinations of 6 letters and digits, and subtract the number of cases where there are only letters in the password:

combinations = $36^6 - 26^6$ (approx 1.868 million)

I tried solving the same problem with the following approach, getting a different value:

1. Take all the combinations of 5 letter-or-digit characters
2. Multiply that by the number of possible positions for the mandatory digit (6)
3. Multiply that by the number of values the mandatory digit could have (10)

combinations = $36^5 \cdot 6 \cdot 10$ (approx 3.628 million)

You counted several things twice in your example. For example, take a look at the password AAAA11.
You counted that password as the password you get when you put the mandatory digit on the sixth place, and write AAAA1 on the other places, and also as the password you get when you put the mandatory digit on the fifth place, and write AAAA1 on the other places.