For this problem we are given that a password is a string of $6$ characters. The password must contain exactly $6$ characters and can contain uppercase and lowercase letters of the alphabet, numbers 0 through 9, and an underscore.

  1. How many passwords cannot have a number character?

    Solution: We know that there are $26$ upper and lower case words, so $52$ letters to choose from, and we can include our underscore. Therefore, we must have $53^6$ passwords.

  2. How many passwords have exactly one underscore and that is not at the beginning or the end of the password.

    Solution: We have one underscore in between the start and the end of the password. $62\cdot 63\cdot 63\cdot 63\cdot 63\cdot 62\cdot = 62^2 \cdot 63^4$

  3. Password must have at least one number.

    Solution: We take all the passwords that have a number and subtract out the number of passwords that don't have a number, $63^6-53^6$

Is my thinking on this correct? I am new to counting and was wondering if my intuition on these problems are on the right track or completely wrong.

  • 2
    $\begingroup$ Your answer for (2) is incorrect. That was the number of passwords which might or might not have contained any underscores such that if it did contain any underscores they would never be at start or end. It missed the fact that there must have been exactly one underscore. For a corrected count, pick where the one underscore goes. Then for the rest of the positions pick a non-underscore character to place there. $\endgroup$ – JMoravitz Oct 12 '20 at 23:10

Your answers to the first and third questions are correct.

As for the second question: Choose which of the four middle positions will be filled with an underscore. Since that is the only underscore, each of the remaining five positions may be filled with one of the other $26 + 26 + 10 = 62$ characters. Hence, there are $$4 \cdot 62^5$$ passwords which have exactly one underscore and the underscore is not at the beginning or the end of the password.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy