[Math] How many odd 4 digit numbers can be formed from the digits 0 through 7 if there must be a 4 in the number and numbers can’t repeat

combinatorics

How many odd 4 digit numbers can be formed from the digits 0 through 7 if there must be a 4 in the number and numbers can't repeat?

The provided answer is 320… I don't know how to get that.

Best Answer

Your number must be odd, so the last digit must be one of $\{1, 3, 5, 7\}$ Now that we've got that dealt with, we can just consider the first three digits.

Our three digit number will be of three possible forms: $4 ? ?, ? 4 ?, ? ? 4$

Case 1: $4??$ - We have now used two digits (the four and whatever odd number we pick to be the last digit), so there are $6 * 5$ ways to pick the next two digits without replacement.

Case 2: $?4?$ - It's similar to the last case except for one fact: The leading digit cannot be $0$ (or else it would be a three digit number). So, there are $6 - 1 = 5$ ways to pick the first digit, and $5$ ways to pick the third. The same holds for $??4$, so that's $2 * 5 * 5$ counting both.

Finally, we have four possibilities for our last digit. To recap, in total we have $4(6*5 + 2*5*5) = 320$ ways to do this.

Problem to apply what you've learned from this post

How many even $5$ digit numbers can be formed from the digits $1$ through $9$ given that there must be a $7$? Note that the digits need not be distinct.