[Math] Number of $6$ digit natural numbers with $3$ odd and $3$ even digits

combinationscombinatorics

I know this has been asked before but I am stuck and need help.
For arranging $6$ digits there are $6! = 720$ ways.
One way is $3$ odd first then $3$ even, which is
$$5 \times 4 \times 3 \times 5 \times 4 \times 3.$$
This is one way, so we multiply this by $720$ (no. of ways) then deduct the numbers where $0$ comes first, but the answer is coming huge, more than total no. of $6$ digit numbers. Where am I wrong?

Best Answer

For arranging $6$ digits, there are $6! = 720$ ways.

This claim is true only if all six digits are distinct. However, $434152$ is a six-digit number with three even and three odd digits.

Find the number of six-digit natural numbers with three even and three odd digits.

Method 1: We add the number of six-digit numbers whose leading digit is odd to those whose leading digit is even.

If the leading digit is odd, two of the remaining five digits are odd. We choose their positions in $\binom{5}{2}$ ways. Each of the three odd digits can be filled in $5$ ways. Each of the three even digits can be filled in $5$ ways. Hence, there are $$\binom{5}{2} \cdot 5^3 \cdot 5^3 = \binom{5}{2}5^6$$ six-digit natural numbers whose leading digit is odd.

If the leading digit is even, it cannot be zero, so it can be filled in $4$ ways. Two of the remaining five digits are even. Their positions can be selected in $\binom{5}{2}$ ways. Each of those positions can be filled in $5$ ways, as can each of the three positions that are filled with odd digits. Hence, there are $$\binom{5}{2} 4 \cdot 5^2 \cdot 5^3 = \binom{5}{2} \cdot 4 \cdot 5^5$$

Hence, the total number of six-digit natural numbers with three even and three odd digits is $$\binom{5}{2}(5^6 + 4 \cdot 5^5) = 5^5\binom{5}{2}(4 + 4) = 9 \cdot 5^5\binom{5}{2} = 90 \cdot 5^5$$

Method 2: We count six-digit sequences with three even and three odd digits, then multiply by $9/10$ to account for the fact that the leading digit cannot be zero.

There are $\binom{6}{3}$ ways to choose the positions of the even digits. The three even digits can each be filled in $5$ ways. The three odd digits can each be filled in $5$ ways. Hence, the number of permissible sequences is $$\frac{9}{10} \binom{6}{3} \cdot 5^3 \cdot 5^3 = \frac{9}{10} \cdot 20 \cdot 5^6 = 9 \cdot 2 \cdot 5 \cdot 5^5 = 90 \cdot 5^5$$