How many $6$-digit different numbers greater than $400000$ can be formed from the digits $2$, $2$, $5$, $6$, $7$, $7$, $8$?
Note: $22$ and $77$ are allowed in the number. For instance, $622775$ is allowed.
My approach: $5$ ways to choose the first digit, $6$ ways to choose the second, $5$ ways to choose the third, $4$ ways to choose the fourth, $3$ ways to choose the fifth and $2$ ways to choose the sixth. So the total arrangement is $5\times 6\times 5\times 4\times 3\times 2 = 3600$. But with the $2,2, 7, 7$ coming up, I think there is more do be done with it. I tried dividing $3600$ by $(2! \times 2!)$. I tried this with a small number of digits and it gave the wrong answer. I am stuck. Can anyone help me with the answer or hint. Thanks
Since the number must exceed $40000000$, the leading digit may be $5$, $6$, $7$, or $8$. Of these digits, only $7$ may be repeated. Therefore, it makes sense to handle the case in which the leading digit is $7$ separately from the others.
Since there are a total of seven available digits, six of them must be used. Since those digits are $2, 2, 5, 6, 7, 7, 8$, there must be at least one repeated digit, but both $2$ and $7$ may appear twice.
The leading digit is $5$, $6$, or $8$: The leading digit can be chosen in three ways.
Both $2$ and $7$ appear twice: Select the leading digit from among $5$, $6$, or $8$. If both $2$ and $7$ appear twice, then we must choose two of the remaining five positions for the $2$s and two of the remaining three positions for the $7$s. We then have two choices for the final open position, namely one of the two numbers from among $5$, $6$, or $8$ which we did not choose as the leading digit. Hence, there are $$\binom{3}{1}\binom{5}{2}\binom{3}{2}\binom{2}{1}$$ such numbers.
Exactly one of $2$ or $7$ appears twice: Select the leading digit from among $5$, $6$, or $8$. Choose whether $2$ or $7$ appears twice. Choose which two of the remaining five positions are occupied by that number. Each of the remaining three positions must be filled with one of the three distinct digits that remain, which can be done in $3!$ ways. For example, if the leading digit is $5$ and $2$ appears twice, the remaining digits are $6$, $7$, $7$, and $8$. However, since only $2$ appears twice, $7$ can only appear once. Thus, the final three positions would have to be filled with $6$, $7$, and $8$. Hence, there are $$\binom{3}{1}\binom{2}{1}\binom{5}{2}3!$$ such numbers.
The leading digit is $7$: The remaining digits are $2, 2, 5, 6, 7, 8$. Therefore, $2$ appears either once or twice.
The digit $2$ appears twice: If $2$ appears twice, we must choose two of the five remaining positions for the $2$s. We then choose which three of the remaining four distinct digits $5, 6, 7, 8$ appear in the remaining three positions, and arrange them in those positions. There are $$\binom{5}{2}\binom{4}{3}3!$$ such numbers.
The digit $2$ appears once: If $2$ appears once, we must fill the remaining five positions with the distinct digits $2, 5, 6, 7, 8$, which can be done in $5!$ ways.
Total: Since the cases described above are mutually exclusive and exhaustive, the number of six-digit numbers greater than $400000$ which can be formed using the digits $2, 2, 5, 6, 7, 7, 8$ is $$\binom{3}{1}\binom{5}{2}\binom{3}{2}\binom{2}{1} + \binom{3}{1}\binom{2}{1}\binom{5}{2}3! + \binom{5}{2}\binom{4}{3}3! + 5! = 900$$