Velvet Star Monitor

Standout celebrity highlights with iconic style.

updates

Number of 6-character passwords with at least 1 digit

Writer Matthew Martinez
$\begingroup$

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)

$\endgroup$ 0

3 Answers

$\begingroup$

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.

$\endgroup$ $\begingroup$

The problem is that you’re counting some passwords more than once. For instance, the password AB1CD2 gets counted once for having a digit in the third position and a second time for having a digit in the last position. The password 123456 gets counted six times in your calculation, once for each of the digits.

$\endgroup$ $\begingroup$

You will use this password to access your account. Enter a combination of at least six numbers, letter and punctuation marks.

$\endgroup$ 1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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