# Find out the number six digit natural numbers such that each digit in number appears at least twice?

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.

• Hi, you seem to have 600 reputation. By then I think you are expected to know how to better typeset your questions. Commented Oct 2, 2017 at 11:30
• Hint: Note that 38880 is already greater than the answer you are supposed to get, so that number is definitely erroneous. Commented Oct 2, 2017 at 11:31
• Hint: think about how you may have double counted in item 3. Commented Oct 2, 2017 at 11:59
• @rogel thanks. Stupid mistake. But still way off from correct answer.
– rugi
Commented Oct 2, 2017 at 12:05
• Does the source of this question count $000101$ as a six digit number for this question? Commented Oct 2, 2017 at 12:41

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.
• Thanks for spoting mistake in my argument and showing correct way.
– rugi
Commented Oct 2, 2017 at 14:27

You're answer is pretty much correct except your calculations for case 3 which was corrected by someone-

As I see you only considered 3 cases. Shouldn't there be 4?

Case 4: 2 digits , one repeated twice and other repeated 4 times like the digit aaaabb or abaaba etc… to solve this we first choose the leading digit in 9C1 ways, there are 5 ways to choose the this by position of other. And then to choose the other digit we multiply this by 9C1 ways

• What do you think of the accepted (i.e. existing already) answer? Welcome to Math Stack. Commented Jul 25, 2023 at 22:13