0

How many ways are there to choose a password that is 6 characters long? Only uppercase alphabets and numeric digits are allowed. There must be at least one numeric digit.

The solution is $36^6 - 26^6$ and I understand why it's correct.

What I don't understand is the reason why is $6! \times 10 \times 36^5$ is incorrect.

N. F. Taussig
  • 76,571
  • 1
    $10\cdot 36^5$ include only passwords with first numeric character, you should add $26\cdot 10\cdot 36^4+26^2\cdot 10\cdot 36^3+26^3\cdot 10\cdot 36^2+26^4\cdot 10\cdot 36+26^5\cdot 10$. Altogether: $10\cdot 36^5+26\cdot 10\cdot 36^4+26^2\cdot 10\cdot 36^3+26^3\cdot 10\cdot 36^2+26^4\cdot 10\cdot 36+26^5\cdot 10$ which gives correct answer, which also can be obtained in more simple way. – Ivan Kaznacheyeu Mar 23 '22 at 09:41
  • @IvanKaznacheyeu I'm sorry, but your answer doesn't seem to match the correct answer. – Sheikh Uzair Hussain Mar 23 '22 at 10:01
  • 1
    It does. $10\cdot 36^5+26\cdot 10\cdot 36^4+26^2\cdot 10\cdot36^3+26^3\cdot 10\cdot 36^2+26^4\cdot 10\cdot 36+26^5\cdot 10=$ $10\cdot 36^5 \cdot (1+(26/36)+(26/36)^2+(26/36)^3+(26/36)^4+(26/36)^5)=$ $10\cdot 36^5 \cdot \frac{1-(26/36)^6}{1-26/36}=$ $10\cdot \frac{36^6-26^6}{36-26}=36^6-26^6$ – Ivan Kaznacheyeu Mar 23 '22 at 10:11
  • 1
    Of course, way with excluding all "bad" passwords from all "possible" passwords is more simple. My answer is about "what's wrong with your calculation". Logic of my answer is counting all "good" passwords only once. $10\cdot 36^5$ is number of "good" passwords with first numeric character. $26\cdot 10\cdot 36^4$ is number of "good" passwords with first non-numeric and second numeric character. $36\cdot 10\cdot 36^4$ will be incorrect, because it counts some "good" passwords again. And so on. – Ivan Kaznacheyeu Mar 23 '22 at 10:17
  • @IvanKaznacheyeu Right. Thank you for clarifying. I appreciate it. – Sheikh Uzair Hussain Mar 23 '22 at 13:43

2 Answers2

0

My thought process:

  • 1st character must be a digit: $10 $ options
  • 2nd character can be anything: $36$ options
  • 3rd character can be anything: $36$ options
  • ...
  • 6th character can be anything: $36$ options

Altogether, these are $10\cdot 36^5$ options.

But wait! This is wrong. Also 2nd character can be a digit ...

Therefore, I will count the options as follows:

  • there are $36^{6}$ possible 6-character sequences
  • there are $26^6$ 6-character sequences that contain only letters: these are not allowed!

So the number of allowed sequences is the differences of the two.

Antoine
  • 3,439
0

The reason why $36^6 - 26^6$ is correct is that in total there are $36$ symbols to pick from, and $6$ places to fill, though any password that has all $6$ symbols letters are excluded, that is $26^6$ such possible passwords. Therefore, we have $36^6$ combinations with any symbols, and must subtract those that are only letters.

The reason why you can not do it your way is due to permutations. The description does not say anything about where the digit should be.