0
$\begingroup$

A symbol in a password is either one of $26$ latin letters or one of $10$ digits. How many $8$ symbol passwords with at least $1$ digit?

I know there are $36^8-26^8$ of them. But at first I thought there were $36^7\times 10$.

What was my mistake? What does the number $36^7\times 10$ represent?

$\endgroup$
4
$\begingroup$

The whole length $8$ password space has size $36^8$. There are $26^8$ passwords with only letters and no digits. So $36^8 - 26^8$ counts the number of passwords with at least one digit.

$10\cdot 36^7$ counts the number of passwords with a digit at the first position, e.g. Or with a digit at the final position. Or any fixed pre-given position for that matter.

To count the number with at least one letter we have the substract the
number of passwords with only digits, so $36^8-10^8$.

$\endgroup$
  • $\begingroup$ Ah, ok, so it's at any position vs at a fixed position. But I still don't understand why $38^7\times 10$ doesn't answer the question. Why is it a wrong answer? Why can't numbers with a digit in a fixed position count as the answer to this question? $\endgroup$ – Coder-Man Sep 25 '18 at 8:16
  • $\begingroup$ @Coder-Man Because if we only count those with a starting digit we miss many passwords, like a1bbbbbb, which would also be a valid one. $\endgroup$ – Henno Brandsma Sep 25 '18 at 8:20
  • $\begingroup$ Oh! Stupid me, now I get it. Thank you very much. $\endgroup$ – Coder-Man Sep 25 '18 at 8:22
  • $\begingroup$ @Coder-Man We could multiply by $8$ for all positions but then we'd double count a password like 12abbbbb which you would count among the passwords with digit at position 1 and at position 2 as well. $\endgroup$ – Henno Brandsma Sep 25 '18 at 8:22
  • $\begingroup$ But how come, even though, as you said, we miss passwords like a1bbbbbb, $38^7\times 10 > 38^8-26^8$? $\endgroup$ – Coder-Man Sep 25 '18 at 8:28
0
$\begingroup$

$36^7 \times 10$ represents all passwords with one number in a chosen position. For $7$ of the places you choose from all possible letters and numbers and for the chosen one you choose only from the numbers.

Assuming your title is correct and you are looking for passwords containing one or more digits, then $36^8 -26^8$ represents the space of all possible passwords minus those which are completely made up of letters.

Similarly, if you were looking for passwords containing one or more letters, then the answer would be $36^8-10^8$, the space of all passwords minus those which are completely made up of numbers.

$\endgroup$
  • $\begingroup$ How is that different from what $36^8-26^8$ represents? $\endgroup$ – Coder-Man Sep 25 '18 at 7:59
  • $\begingroup$ You didn't write it correctly, I didn't say it's $36^8-10^8$ $\endgroup$ – Coder-Man Sep 25 '18 at 8:00
  • $\begingroup$ @Coder-Man I am asking you if that is what you meant? $36^8-26^8$ is all passwords containing a number not a letter $\endgroup$ – lioness99a Sep 25 '18 at 8:01
  • 1
    $\begingroup$ not at least one number, but say a number at the final position. You cannot choose the digit position freely. $\endgroup$ – Henno Brandsma Sep 25 '18 at 8:03
  • $\begingroup$ Title ask for password with a number, and question body ask for password with a letter. I think OP made a typo, but from the results he gets, the title seems to be correct $\endgroup$ – F.Carette Sep 25 '18 at 8:03

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.