Can anyone help to verify if my reasoning is correct? The way I look at it is that if we use:

(all possible combinations) - (at most two digits are the same) - (exactly $4$ digits are the same)

then we get exactly $3$ digits are the same namely:

$$9 \cdot 10 \cdot 10 \cdot 10 - 9 \cdot 10 \cdot 10 \cdot 9 - 9$$

Is that right?

  • $\begingroup$ Pick which digit is repeated. If zero, it could not have been the first digit so pick what the first digit is. If not zero, pick what the other digit is. If that other digit was zero, pick which of the three spaces which aren't at the front it occupies. If that other digit wasn't zero, pick which of the four spaces it occupies. $\endgroup$ – JMoravitz Oct 3 '17 at 3:01

First do the case in which none of the digits is $0$.

There are $9$ ways to choose the digit that repeats $3$ times and $8$ ways to pick the other, after this there are $4$ ways to order the digits. So $9\times8\times 4$.

Now we look at the cases in which the digit $0$ repeats $3$ times. Clearly the $9$ numbers are $1000,2000,3000,\dots,9000$.

Lastly we look at the cases in which $0$ appears once. There are $9$ ways to pick the other digit and $3$ ways to order.

So the final answer is $9\times8\times4+9+9\times 3$.

  • $\begingroup$ Hey should it be 9 x8 x 4 in that case ? $\endgroup$ – Snailwalker Oct 3 '17 at 3:06

You have $10\choose2$ choices for the two digits to use and $2\choose1$ choices for which one is repeated three times. Then $4$ possible arrangement for each pair thus chosen (e.g. $1222,2122,2212,2221$).

But then we have to account for the fact that $0$ is not a legal FIRST digit, so you can't have $0200$, but you CAN have $2000$ or $2022$. Fortunately this is easy: by symmetry, one tenth of the values we've counted thus far begin with a zero, so we multiply by $9/10$ for the final answer.

$${10\choose2}{2\choose1}(4) \frac 9 {10}$$ $$=324$$

To make it simpler:

Choose the digit to be repeated three times; 10 choices. Choose the other digit; 9 choices. Choose the position for the other digit; 4 choices.

Now discount the options with a zero coming first by multiplying by 9/10.

$$10\times9\times4\times\frac 9 {10} = 9\times9\times4=324$$

  • 2
    $\begingroup$ Instead of using $\binom{10}{2}\binom{2}{1}$ I suggest $10\times 9$ from the start. Nice use of symmetry by the way. $\endgroup$ – Jorge Fernández Hidalgo Oct 3 '17 at 3:08
  • $\begingroup$ @JorgeFernández, thanks; I've incorporated that in my addendum. :) Symmetry is fun! $\endgroup$ – Wildcard Oct 3 '17 at 3:11
  • 1
    $\begingroup$ Thank you for your effort on this. I like both answers , but Jorge's one is easier for me to understand. Wish I could check both answers. $\endgroup$ – Snailwalker Oct 3 '17 at 3:23

You're mistaken in thinking that $9*10*10*9$ counts $4$ digit numbers with at most two digits the same. Whatever you pick for the first digit, you can pick for the second and third digit. Counting such numbers would probably require an expression with multiple terms.

Instead, I'd recommend counting it this way: you have two cases, either the last three digits are the same, or one of the last three digits is different from the other three digits. That should give you an easier way of counting this.

EDIT: Seeing all of the different solutions, I might as well give a complete solution. If the last three digits are the same, the first digit $a$ can be anything but $0$, and the last three digits can be anything but $a$, so you get $9*9$. If one of the last three digits is the odd one out, then there are $3$ choices for which one it is. Then the three same digits $a$ can be anything except $0$ (since they include the first digit), and the last digit can be anything except $a$, so you get $3*9*9$. Then your answer is $9*9+3*9*9=4*9*9$.

  • $\begingroup$ Thank you for explaining. This one is very close to my original approach. $\endgroup$ – Snailwalker Oct 3 '17 at 3:43

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.