1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Number of possible passwords

  1. Oct 31, 2016 #1
    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. jcsd
  3. Oct 31, 2016 #2
    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
  4. Oct 31, 2016 #3

    phyzguy

    User Avatar
    Science Advisor

    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.
     
  5. Oct 31, 2016 #4
    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?
     
  6. Oct 31, 2016 #5

    andrewkirk

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    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.
     
  7. Oct 31, 2016 #6

    phyzguy

    User Avatar
    Science Advisor

    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.
     
  8. Oct 31, 2016 #7
    (366-266)+(367-267)+(368-268)

    Is the answer I was talking about.
     
  9. Nov 1, 2016 #8

    haruspex

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    2016 Award

    This being a homework forum, that's rather too much help at this stage.
     
  10. Nov 1, 2016 #9

    haruspex

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    2016 Award

    True, but not very efficient. Sometimes it is simpler to overcount then subtract out those that violated the rules.
     
  11. Nov 1, 2016 #10
    I'm sorry about that, I thought the post above had posted an answer too.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted