We have $4$ digit code or number. Every digit can be integers from $[0,5]$, i.e. $6$ different values. Question is two find number of possibilities where exactly two of the digits are the same. e.g. 1231,1132,2311,..are some of results.
2 Answers
Question is to find the count of possibilities where exactly two of the digits are the same.
That is: a double and two singletons.
Count the ways to select $2$ from $4$ places for the repeated digit, select $1$ from $6$ digits to repeat, and then select $2$ distinct digits from the remaining $5$ digits to be the singletons and the order to put them.
$$\binom 4 2\binom 6 1\binom 5 2\cdotp2!$$
- 129,094
-
I feel you still need to multiply by $2$ -- you've chosen your last two digits, but not which one goes in which position. – Nick Peterson Nov 17 '16 at 04:05
-
Indeed, good catch. – Graham Kemp Nov 17 '16 at 04:25
We need to choose three digits, and distinguish one of them as the repeated digit; the number of ways to do this is $$ \binom{6}{3}\cdot3=20\cdot3=60 $$ ways to do this.
Now, we have to position the digits. The repeated digits can take up any two out of the four spaces; so, there are $\binom{4}{2}=6$ ways to do this. Now, let's position the smaller of the remaining digits; there are two ways to do that. And finally, the last remaining digit only has one place to go.
So, all in all, there are $$ \binom{6}{3}\cdot3\cdot\binom{4}{2}\cdot2=720 $$ different combinations possible.
- 32,430