Possible Password Combinations

  • Thread starter Thread starter Mr Davis 97
  • Start date Start date
AI Thread Summary
The discussion focuses on calculating the number of possible passwords that are six to eight characters long, consisting of uppercase letters and digits, with the requirement that each password must include at least one digit. Initial calculations attempted to count combinations but led to overcounting, particularly with passwords containing multiple digits. A suggested approach is to start with the total combinations and subtract those that contain no digits, which simplifies the process. Additionally, a direct counting method is proposed, where each case of digits is calculated separately to avoid overcounting. The conversation emphasizes the importance of careful counting methods in combinatorial problems.
Mr Davis 97
Messages
1,461
Reaction score
44

Homework Statement


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?

Homework Equations

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?
 
Physics news on Phys.org
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:
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.
 
phyzguy said:
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.
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?
 
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.
 
Mr Davis 97 said:
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?

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.
 
(366-266)+(367-267)+(368-268)

Is the answer I was talking about.
 
Emilyneedshelp said:
(366-266)+(367-267)+(368-268)

Is the answer I was talking about.
This being a homework forum, that's rather too much help at this stage.
 
phyzguy said:
This should work.
True, but not very efficient. Sometimes it is simpler to overcount then subtract out those that violated the rules.
 
  • #10
haruspex said:
This being a homework forum, that's rather too much help at this stage.

I'm sorry about that, I thought the post above had posted an answer too.
 
Back
Top