How many 5-digit numbers are there, such that only one number appears more than once

combinatorics

How many 5-digit numbers are there, such that only one number appears more than once (numbers starting with $0$ are also eligible, e.g. $05125$)?

The way I tried to solve the problem was to break it into pieces and examine them one by one, so:

  • 5 occurences: $10$ possibilities
  • 4 occurences: $10 \cdot 9 \cdot \binom{5}{1} = 450$ possibilities
  • 3 occurences: $10 \cdot 9 \cdot 8 \cdot \binom{5}{2} = 7200$ possibilities
  • 2 occurences: $10 \cdot 9 \cdot 8 \cdot 7 \cdot \binom{5}{3} = 50400$ possibilities

And then I added them up, which gave me a total of $58060$ possible numbers which meet the requirement. Could you tell me whether my solution is correct, as I did not have any contact with combinatorics for a few years and I still struggle with these exercises?

Best Answer

$58060$ is the correct answer. Your calculation is totally correct. I wrote a pascal program to verify it: https://onlinegdb.com/BJ0eecZiS