How many positive five digit numbers have a 1, 3, 7 or 5 in them?

1 answer

We can use the principle of inclusion-exclusion to count the number of positive five-digit numbers that have a 1, 3, 7, or 5 in them.

First, we count the total number of five-digit numbers: there are 9 possible digits for the first digit (since it cannot be 0), and 10 possible digits for each of the remaining four digits. Therefore, there are $9\cdot10^4$ five-digit numbers.

Next, we count the number of five-digit numbers that do not have a 1, 3, 7, or 5 in them. For each digit, there are 5 possible digits remaining (since we cannot use 1, 3, 7, or 5). Therefore, there are $5^5$ such numbers.

Therefore, by the principle of inclusion-exclusion, the number of positive five-digit numbers that have a 1, 3, 7, or 5 in them is $9\cdot10^4 - 5^5 = 90,\!000 - 3,\!125 = \boxed{86,875}$.