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

Additional text:
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)

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!}$
