write five digits numbers using $0,0,0,1,1,2,2,2,2,3,3,3,4,4$.

It is given that we want to write five digits numbers using $0,0,0,1,1,2,2,2,2,3,3,3,4,4$.

How many ways are there to write it $?$

My thought In the first place, it seems cumbersome question a little bit , because i think that we should write them separately in terms of the leading term such that firstly i check over $1$ as leading term , then $2$ so on. However , this process is exhaustive and i hope to find elegant approach for this question.


Here is a method which still requires a bit of work, but which is still more efficient then naive brute force.

Start with a simpler question:

For each $k=1,2,\dots,5$, how many $k$ digit numbers can you make using $3, 3, 4, 4, 4$?

With a little work, the answers are

k 1 2 3 4 5
# numberss with k digits using 3s and 4s 2 4 7 10 10

Next....

For each $k=1,2,\dots,5$, how many $k$ digit numbers can you make using $2,2,2,2,3,3,4,4,4$?

The key is that we can leverage or work in the previous step to make this one easier. Take the summation of all ways to place the $2$'s, times the number of ways to fill in the rest of the empty spaces with $3$'s and $4$'s, the latter of which can be looked up in the previous table. For example,

\begin{align} \text{# $5$-digit nums with $2$'s, $3$'s and $4$'s} &= \binom{5}0\cdot \hspace{-1cm} \overbrace{10}^\text{# 5 digit nums with 3,4}\hspace{-.1cm} + \binom{5}1\cdot \hspace{-1cm}\overbrace{10}^\text{# 4 digit nums with 3,4}\hspace{-1cm} \\ &+ \binom{5}2\cdot \hspace{-1cm}\underbrace{7}_{\substack{\;\\\\\text{# 3 digit nums with 3,4}}}\hspace{-.1cm} + \binom{5}3\cdot \hspace{-1cm}\underbrace{4}_\text{# 2 digit nums with 3,4}\hspace{-.1cm} \\&+ \binom{5}4\cdot \hspace{-1cm}\underbrace{2}_{\substack{\;\\\\\text{# 1 digit nums with 3,4}}}\hspace{-1cm} \hspace{1.5cm}=\boxed{180} \end{align} You then have to do the same for the $1,2,\dots,4$ digit numbers, giving another row to the table. Then, use that row to calculate the number of numbers where you can use digits $1$ to $4$.

k 0 1 2 3 4 5
# numbers with k digits using 3s and 4s 1 2 4 7 10 10
# numbers with k digits using 2, 3, and 4 1 3 9 26 71 180
# numbers with k digits using 1, 2, 3 and 4 1 4 16 62 229 795

Finally, the number of five digit numbers using all available digits is found by summing over all ways to place the zeroes, times the number of ways to fill what remains with $1$ to $4$, which is in the last row of the table: $$ \binom{4}0\cdot 795+\binom{4}1\cdot 229+\binom{4}2\cdot 62+\binom{4}3\cdot 16=\boxed{2147} $$


Digits given: $0,0,0,1,1,2,2,2,2,3,3,3,4,4$ and we need to make five digit numbers from them. Removing bad cases seems to be a good choice here, even though there is a bit more work in the end for removing numbers with leading zeroes. The point to note is that you do not have any overlap between bad cases of two numbers or more, on other words, we cannot simultaneously have bad cases for two of them.

Number of bad cases for $0$ or $3 = \underbrace{5 \cdot 4}_{\text{Four 0's}} + \underbrace{1}_{\text{Five 0's}} = 21$

Number of bad cases for $1$ or $4 = {5 \choose 3} \cdot 4^2 + 5 \cdot 4 + 1 = 181$

Number of bad cases for $2 = 1$

Total number of bad cases $ = 2 \times 21 + 2 \times 181 + 1 = 405$

Subtract this from total number of unrestricted cases $ = 5^5 = 3125$ (if we had $5$ choices for each digit). That gives us an answer of $2720$.

Now as we need proper $5$ digit numbers where leading zeroes are not allowed,

Numbers with leading zeroes $ = 5^4$. Out of which below are already counted in above bad cases -

In bad cases for $0$, only $4$ start with another digit so $17$ duplicates.

In bad cases for $3$, numbers with leading zeros $ = 1$ (fix first digit as $0$, then remaining four digits are all $3$).

In bad cases for $1$ (or $4$), numbers with leading zeroes $ = 4 \cdot 4 + 1 = 17$ (first digit $0$, choose three out of four remaining digits as $1$ and the last remaining digit other than $1$ or all four digits as $1$).

So total five digit numbers without leading zeroes $ = 2720 - 5^4 + 52 = 2147$