# How many six digit numbers contain exactly 4 different digits?

Following the logic from the link Number of 4-digit numerals with at most 2 different digits

Writing steps in the same manner :

1) In this question, we have to find exactly 4. ( not like in that question where atmost 2 distinct digits were required ) . So this case NA.

2) Here I tried C(9,4)( C(4,2)*6!/2!.2! + C(4,1)*6!/3! ). This is the case where we exclude 0.

3) In this case, we consider 0, I didnt understand this case in that question too.

So , Can anyone verify if my approach is correct. What could be the third case in this question, following like they did in the question linked above ?

OR if you can suggest other approach altogether. I consider few more approaches for the linked question (How many 4 digit numbers are there which contains not more than 2 different digits?). But, I could not extrapolate their concept to 6 digits and 4 distinct numbers.

• Are initial $0$'s allowed, as in $010123$? That has a nice structured solution. Not allowing initial $0$'s complicates things. – André Nicolas Mar 11 '14 at 20:52
• No, initial 0's not allowed.. – PrateekArora Mar 11 '14 at 20:56

In 2, you are picking the four different digits with C(9,4), then the C(4,2)picks the two of them that will be paired and the $\frac {6!}{2!2!}$ chooses the order. The other terms handles three of one digit plus three more. This is correct.

If you consider zero and allow it to be leading, you just change the $9$ to $10$ in your previous answer as you have one more kind of digit to choose from.

The hard part comes where you don't allow zero in the lead position. But there is a simple way to fix that: do the computation allowing all ten digits in any position. As the digits are treated on an equal footing, one tenth will start with zero. So multiply by $\frac 9{10}$

• :O .. You sir took my breath away with the last sentence .. So I would do TEMP = C(10,4)( C(4,2)*6!/2!.2! + C(4,1)*6!/3! ) and then (9*TEMP)/10 .. And it seems to produce correct ans. ( Initial 0's not allowed)... – PrateekArora Mar 11 '14 at 21:03
• Yes, that is just what you would do. Symmetry is wonderful. Sometimes, like here, it is easier to overcount something very symmetric and then correct. – Ross Millikan Mar 11 '14 at 22:33