How many 6 digit numbers are possible with at most three digits repeated?
My attempt:
The possibilities are:
A)(3,2,1) One set of three repeated digit, another set of two repeated digit and another digit (Like, 353325, 126161)
B)(3,1,1,1) One set of three repeated digit, and three different digits.(Like 446394, 888764)
C)(2,2,1,1) Two sets of two repeated digits and two different digits (Like, 363615, 445598)
D)(2,2,2) Three sets of two repeated digits (Like, 223344, 547547)
E)(2,1,1,1,1,1) One set of two repeated digit and four different digits (Like 317653, 770986)
F)(1,1,1,1,1,1) Six Different digits (like 457326, 912568)
G)(3,3) Two pairs of three repeated digits. Let's try to calculate each possibilities separately.
F) is the easiest calculate.
Let us try to workout Case E)
Let's divide the case into two parts:
Case E(1) Zero is not one of the digit
We can choose any $5$ numbers form $9$ numbers $(1,2,3,\cdot, 9)$ in $\binom{9}{5}$ ways , the digit which one is repeated can be chosen in 5 ways, and you can permute the digits in $\frac{6!}{2!}$ ways. The total number of ways$=\binom{9}{5}\times 5\times \frac{6!}{2!} $
Case E(2) Zero is one of the digit.
Case E(2)(a) Zero is the repeated digit We need to choose four other numbers which can be done in $\binom{9}{4}$ ways, the digits can be permuted in $\frac{6!}{2!}$ ways, but we need to exclude the once which starts with zero ($5!$ many). The total number of ways =$=\binom{9}{4}\times (\frac{6!}{2!} -5!)$.
Case E(2)(b) Zero is not the repeated digit We need to choose four other numbers which can be done in $\binom{9}{4}$ ways, the repeated digit can be chosen in 4 ways, the digits can be permuted in $\frac{6!}{2!}$ ways, but we need to exclude the once which starts with zero ($5!$ many). The total number of ways =$=\binom{9}{4}\times 4\times (\frac{6!}{2!} -5!)$.
Before, proceeding to workout the other cases, I want to know
- Is my attempt correct?
- If it is correct, it is too lengthy, is there any other way to solve this?