[Math] How many $5$-digit zip codes are there with exactly $n$ odd digits

combinatorics

If zip codes have $5$ digits and each digit can be $0, 1, 2, 3, 4, 5, 6, 7, 8, 9$, then how many zip codes are there with exactly $n$ odd digits?

The way I see it, there are $10^5$ possibilities total.

For exactly one odd digit, we need one odd digit and four even digits. Which makes the answer $5^5$ but this can't be right, because according to this same logic $5^5$ is the answer for all other $n$'s too!

EDIT: And this also doesn't take position into account. I.e. 52222 is not the same as 25222 and etc.

Best Answer

First we look at the zipcodes using only $o$'s and $e$'s, where $o\in \{ 0,2,4,6,8\}$ and $e\in \{1,3,5,7,9\}$.

There are $5 \choose n$ ways to make a zipcode for which the number of $o$'s is $n$.
So for instance, there are $5$ zipcodes with one $o$ (e.g. $eeeeo$).

Then we say: For each $e$ and each $o$ there are five possibilities. This means that there are a total of ${5\choose n} 5^5$ ways to make a $5$-digit zip code with $n$ odd digits.

Check: $$\sum_{k=0}^5{5\choose k}5^5=5^5\sum_{k=0}^5{5\choose k}=5^5(1+5+10+10+5+1)=5^5\cdot 32=5^5\cdot 2^5=10^5 \tag{$\checkmark$}$$