[Math] Find out the number six digit natural numbers such that each digit in number appears at least twice

combinatoricscontest-math

In each of the six digit numbers $333333,225522,118818,707099$ each digit in number appears at least twice.Find out the number of such six digit natural numbers.

My Attempt
We observe that three possible situation may occur.

  1. There is only one digit.
  2. There are two digits.
    • One digit occurs twices and second digit occurs four times.
    • both the digits occur three times.
  3. there are three digits each occurring two times.

Now we count each of the cases

  1. There are $9$ such numbers.
  2. $ $
    • First digit can be chosen in $9 \choose 1$ way. If first digit is repeated twice then the second occurrence may be placed in $5 \choose 1$ positions. The second digit can be chosen in $9 \choose 1$ ( now zero can be chosen) and they be placed in the remaining four places in one way. Thus number of ways are $9*5*9=405 $
      If first digit is repeated four times then number of ways are $9*10*9=810$ Thus total count in 2a is $405+810=1215$
    • Total count is $9*10*9=810$
  3. Total count =$9*5*9*6*8=19440$

Thus grand total = $9+1215+810+19440=21474$
But answer supplied is $11754$. Can anyone help to to get right answer and spot mistake in my argument? Thanks in advance.

Best Answer

You counted all the cases except the case in which there are three digits that each appear twice.

There are $9$ ways to select the leading digit, $5$ ways to choose the other position for the leading digit, $\binom{9}{2}$ ways to select the other two digits, and $\binom{4}{2}$ ways to choose the positions of the smaller of those digits. Therefore, the number of six-digit positive integers in which there are three digits that each appear twice is $$\binom{9}{1}\binom{5}{1}\binom{9}{2}\binom{4}{2} = 9720$$

You counted each such case twice. For instance, take the number $837783$. You counted it in two ways:

  1. You selected $8$ as the leading digit, then chose to place it in the fifth position. You selected $3$ as the second digit, then chose to place it in the second and sixth positions. You chose $7$ as the third digit and placed it in the third and fourth positions.
  2. You selected $8$ as the leading digit, then chose to place it in the fifth position. You selected $7$ as the second digit, then chose to place it in the third and fourth positions. You chose $3$ as the third digit and placed it in the second and sixth positions.