[Math] How many 6 digit numbers with 2 or 3 repetitions allowed

combinatorics

Solution is pretty well known for the question: how many $6$ digit numbers can be written by using digits $0,..,9$, where, every digit can be used only once.

However, while I was thinking today, I could not find a short way to solve if $2$ or $3$ repetitions are allowed. Hence, I wanted to ask you if you know a short way to solve it:

How many $6$ digit numbers can be written by using digits $0,…,9$

a) That any digit forming the number can repeat at most $2$ times? (Any digit should not be repeated for more than 2 times. For example $112233$ is allowed but $111222$ is not)

b) at most $3$ repetitions? (solution is quite similar to part a I guess. This time $111222$ is allowed,but $111122$ is not)

Regards,

Amadeus

Best Answer

For pairs: the permutations over 6 for 3 pairs will be $\binom{6}{2,2,2}=90$ and it variations will be $(10)_3$. The problem are the starting zeroes and the repeated strings that come from variations+permutations of groups with same cardinality, the prohibited starting zeroes numbers will be the 10%, and the repeated numbers cause permutations of groups of same cardinality we can eliminate discounting these permutations ($\frac{1}{k!(6-2k)!}$). So, by example, for 3 pairs will be:

$$90\cdot (10)_3\cdot\frac{9}{10}\cdot \frac{1}{3!}=3^5\cdot 40$$

And the general case will be

$$\frac{9}{10}\sum_{k=0}^{3}\frac{6!(10)_{6-k}}{(2k+0^k)k!(6-2k)!}=\frac{9\cdot6!\cdot(10)_3}{10}\sum_{k=0}^{3}\frac{(7)_{3-k}}{(2k+0^k)k!(6-2k)!}=X$$

For triples it will be the previous number more the compositions with a triple and a pair, a triple only, or two triples.

The point is to change the composition of the denominator of the multinomial coefficient to represent the groups that compose the number and for every composition multiply for the number of variations that will be the falling factorial of 10 to the number of different groups in the number, an after down the total to it 90% cause the numbers cant start with 0 to have 6 digits.

For triples will be

$$X+\frac{9}{10}\sum_{j=1}^{3}\binom{6}{j,3}\frac{(10)_{5-j}}{2^{\delta_{j,3}}3^{\delta_{j,1}}}$$

EDIT: sry for too much editions, a lot of tiny and stupid mistakes. I think now is correct.