# How many six-digit numbers can I create using these digits {$1$, $4$, $4$, $5$, $5$, $5$, $7$, $9$}

## Step 1 - Determine how many six-digit numbers can we create if we had $8$ distinct digits

|{$1$, $2$, $3$, $4$, $5$, $6$, $7$, $8$}| = 8

n!/(n-p)!

8!/(8-6)! = $20160$

BUT I have {$1$, $4$, $4$, $5$, $5$, $5$, $7$, $9$}

4's repeat 2 times

5's repeat 3 times

After this step, I have no idea what to do.

I need an explanation which involves:

• number $2$ (number of repeating 4's)
• number $3$ (number of repeating 5's)

Please try to explain this using inclusion-exclusion method

If he had 8 distinct digits we can calculate this without a problem. But when we have repeating digits we have to subtract something (and I don't know how to find that 'something')

If he had {1,2,3,4,5,6,7,8} we can make 20160 numbers:

• 123456

• 123457

• 123458

• 123465

• 123467

• 123468

...

• 887654

But let's say we had {1,2,3,4,5,6,8,8}

For easier understanding, I will visually distinct these 8's with an 'a' and 'b'

{1,2,3,4,5,6,8a,8b}

Following numbers would be:

• 123456
• 123458a
• 123458b
• 123465
• 123468a
• 123468b

Once you remove 'a' and 'b' you will get duplicate numbers, which cause a problem

• 123456
• 123458
• 123458 (duplicate)
• 123465
• 123468
• 123468 (duplicate)

We need to find how many duplicates are there, and then subtract them with original number (20160)

• What do you know about the inclusion-exclusion method? Can you show us how you have applied this principle and where you get it wrong? This will help us better to answer your question – GNUSupporter 8964民主女神 地下教會 Mar 12 '17 at 11:59
• Check the edit on the original post – user424812 Mar 12 '17 at 12:20

Case $1$: pick six digits from the $3$ distinct digits and $(5,5,5)$

$\dfrac{6!}{3!}$

Case $2$: pick six digits from the $3$ distinct digits and $(5,5,4)$

$\dfrac{6!}{2!}$

Case $3$: pick six digits from the $3$ distinct digits and $(5,4,4)$

$\dfrac{6!}{2!}$

Case $4$: pick six digits from $2$ distinct digits and $(5,5,5,4)$

$\dbinom{3}{2}\dfrac{6!}{3!}$

Case $5$: pick six digits from $2$ distinct digits and $(5,5,4,4)$

$\dbinom{3}{2}\dfrac{6!}{2!.2!}$

Case $6$: pick six digits from $1$ distinct digit and $(5,5,5,4,4)$

$\dbinom{3}{1}\dfrac{6!}{3!.2!}$

• Could you explain this answer a bit? – user424812 Mar 12 '17 at 12:25
• there are only possibilities when you select 6 digits. the selection may contain only one occurrence of 5 or two occurrences of 5 or three occurrences of 5. if we split into three cases, then it is easy to compute. – Kiran Mar 12 '17 at 12:28
• That's only for 5's. What about 4's? I do the same thing with 4's, right? – user424812 Mar 12 '17 at 12:33
• you are right, did not notice that. editing my answer – Kiran Mar 12 '17 at 12:39
• see the edited answer which includes the missing cases as well – Kiran Mar 12 '17 at 12:47