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.

  • 1
    $\begingroup$ Firstly, there's no digit '10' in any zipcodes, but there are still $10^5$ possibilities. First, find all arrangements of 4 even numbers. Then insert 1 odd number. $\endgroup$ – Ian Coley Apr 8 '14 at 22:26
  • $\begingroup$ One odd: The location of the odd can be chosen in $\binom{5}{1}$ ways. For each of these ways, the oddball can be chosen in $5$ ways. And now the rest of the slots can be filled with evens in $5^4$ ways. Two odd: Locations can be chosen in $\binom{5}{2}$ ways. The two locations can be filled with odds in $5^2$ ways. And the rest can be filled with evens in $5^3$ ways. $\endgroup$ – André Nicolas Apr 8 '14 at 22:32

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$}$$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.