# Homework Help: Number of possible passwords

1. Oct 31, 2016

### Mr Davis 97

1. The problem statement, all variables and given/known data
Each user on a computer has a password, which is six to eight characters long, where each character is an uppercase letter or a digit. Each password must contain at least one digit . How many possible passwords are there?

2. Relevant equations

3. The attempt at a solution
My reasoning was as follows: First, for passwords with length 6, we can choose the 6 places where at least one digit will go, and that digit can be chosen in 10 different ways. Then we multiply this by $36^5$, since that is the number of choices we have for the other characters in the password of length 6. We apply similar reasoning to passwords of length 7 and length 8, and get $10 \cdot 6 \cdot 36^5 + 10 \cdot 7 \cdot 36^6 + 10 \cdot 8 \cdot 36^7$. However, this is not the right answer. Where am I going wrong?

2. Oct 31, 2016

### Emilyneedshelp

There seems to be no restraint on having a password of only numbers, your reasoning creates this restraint.

366 will give you all the possible passwords for a six character long passwords containing 0-9 and a-z (note: passwords only containing letters are still in the mix.) Now you need to find a way to separate to passwords containing only letters.

Last edited: Oct 31, 2016
3. Oct 31, 2016

### phyzguy

I think you are counting many combinations more than once. For example, you are counting the combination 111111 six times. It's easy to see that your calculation can't be right, because 10*6*36^5 is greater than the 36^6 combinations of six characters ignoring how many digits there are. I would start with the 36^6 possible sequences, then subtract the ones that have no digits. This is a smaller number than your calculation.

4. Oct 31, 2016

### Mr Davis 97

So your method of counting the complement is good, and it works. But I'm just curious, is there any way to directly counting how many passwords there are without overcounting? Would it be to complicated to justify doing?

5. Oct 31, 2016

### andrewkirk

Your method double counts all passwords with two digits, triple counts all passwords with three digits and so on. For example 1AAAA2 is counted once where the '1' is the digit chosen in your first factor of 10 and once where the '2' is that digit.

You need to make the first digit chosen special in some way. For instance you could make it the earliest digit in the six characters. Approaching it that way you can avoid multiple counting.

EDIT: added because the above two posts appeared while I typed mine. The method of the previous paragraph will allow you to calculate the number of passwords without having to deduct anything.

6. Oct 31, 2016

### phyzguy

You could count all passwords with 1 digit $$10*25^5*\frac{6!}{5!*1!}$$+ all passwords with 2 digits $$10^2*25^4*\frac{6!}{4!*2!}$$, etc. This should work.

7. Oct 31, 2016

### Emilyneedshelp

(366-266)+(367-267)+(368-268)

8. Nov 1, 2016

### haruspex

This being a homework forum, that's rather too much help at this stage.

9. Nov 1, 2016

### haruspex

True, but not very efficient. Sometimes it is simpler to overcount then subtract out those that violated the rules.

10. Nov 1, 2016