[Math] How many 9-digit numbers are there with twice as many different odd digits involved as different even digits.

combinatorics

How many 9-digit numbers are there with twice as many different odd digits
involved as different even digits (e.g., 945222123 with 9, 3, 5, 1 odd and 2, 4
even).

(5c1)(5c2)3^9 +(5c2)(5c4)6^9+(5c3)(5c6)9!

even:0 2 4 6 8

odd:1 3 5 7 9

pick out the even one first
then pick out odd , then order them

is that correct?
i think im missing the situation that the number cannot start with 0.

Best Answer

You’re right in thinking that the number of distinct odd digits cannot be more than $3$. You’re also right in thinking that there are $\binom51\binom52$ ways to choose one odd digit and two even digits, $\binom52\binom54$ ways to choose two odd and four even digits, and $\binom53\binom56$ ways to choose three odd and six even digits, but you should notice that $\binom56=0$: you can’t pick $6$ different even digits when only $5$ are available. Thus, there are really only two cases to consider: one odd digit and two even digits, and two odd and four even digits. The real work, though comes in counting the ways to arrange the digits once you’ve chosen them.

Suppose that you’ve chosen an odd digit, $d$, and two even digits, $e_0$ and $e_1$. If you use $d$ only once, you can put it in any of $9$ positions in the number. Then you can distribute $e_0$ and $e_1$ in the other $8$ positions however you please, except that you cannot use just $e_0$ or just $e_1$. There are $2^8$ ways to distribute $e_0$ and $e_1$ among the $8$ open positions, but two of those use only one of the digits, so there are $2^8-2$ ways that use both digits. Thus, we get a total of $9(2^8-2)$ nine-digit numbers in this subcase. If you use $d$ twice, there are $\binom92$ pairs of positions in which you can place the two $d$’s, and by the same reasoning as before there are $2^7-2$ ways to distribute $e_0$’s and $e_1$’s amongst the remaining $7$ places, so there are $\binom92(2^7-2)$ nine-digit numbers in this subcase. Continuing in this fashion, it’s a little tedious but not hard to get the number of nine-digit numbers in this case.

If instead you’ve chosen odd digits $d_0$ and $d_1$ and even digits $e_0,e_1,e_2$, and $e_3$, you can reason similarly, though there’s a little more work involved. Suppose, for instance, that you’ve decided to put the odd digits into $4$ spots, leaving the other $5$ for the even digits. There are $\binom94$ ways to choose the $4$ positions for the odd digits. There are $2^4-2$ ways to distribute $d_0$ and $d_1$ amongst these $4$ positions, excluding the two ways that use only one of the two digits. It remains to count the ways to distribute the even digits amongst the other $5$ positions. Clearly one of them must appear twice and the other three once each. There are $4$ ways to pick the one that appears twice, and there are $\binom52$ ways to pick the slots for it. There are then $3!$ ways to permute the remaining $3$ even digits amongst the remaining three slots, for a grand total of $\binom94(2^4-2)\cdot4\binom52\cdot3!$ numbers. There a few more subcases, depending on how many places you fill with odd digits, but you can use the same basic ideas for all of them.