The content in this post is taken from this video on the YouTube channel MindYourDecisions. Figure 1 shows if the digits of a four digit code are known, there are 24 possibilites of the code contains four distinct digits but 36 possibilities if the code contains only three digits (with one digit repeated).
![]() |
Figure 1 |
If no digits are repeated, then there are:$$4! = 4 \times 3 \times 2 \times 1 =24 \text{ possibilities}$$However if one digit is repeated then we have:$$ \frac{4!}{2!} \times 3 = 36 \text{ possibilities}$$What happens with a six digit passcode when we know the digits but not the order. If six digits are used, then we have:$$6! = 6 \times 5 \times 4 \times 3 \times 2 \times 1 = 720 \text{ possibilities}$$However, if one digit is repeated then we have:$$ \frac{6!}{2!} \times 5 =1800 \text{ possibilities: see Figure 2}$$
![]() |
Figure 2 |
The formulae in general for distinct digits versus one repeated digit are:$$ n! \leftarrow \text{ versus } \rightarrow \frac{(n-1) \times n!}{2}$$Once we have \(n \geq 4\) then \( (n-1)/2 \) is greater than 1 and so the single repeated digit passcode will always yield more possibilities than the distinct digits. What about repeating more than one digit?
Figure 3 shows the situation for six digit passcodes where it can be seen that one repeated digit yields the most possibilities:
![]() |
Figure 3 |
However, for a seven digit posscode, using five distinct digits (with two digits repeated) yields the most possibilities. See Figure 4.
![]() |
Figure 4 |
The video referenced earlier concludes with a mention of the general case and a rather formidable formula that I won't go into here.




No comments:
Post a Comment