# How many numbers are there which have five digits, each having a number in $\{1,2,3,4,5,6,7,8,9\}$ and either having all odd or all even?

How many numbers are there which have five digits, each having a number in $\{1,2,3,4,5,6,7,8,9\}$ and either having all odd or all even?

Solution:

So there are 5 digits in that set that are odd, and 4 that are even

Case 1: all odd

we would have $5*5*5*5*5=5^5$

Case 2: all even

we would have $4*4*4*4*4 = 4^5$

Therefore combining both cases we have $5^5+4^5$

I am wondering if this logic is correct as it is my first few problems solved like this.

• You must be assuming that the numbers may be used repeatedly, else you would not have $5$ digits that are all even. Yes? If so, yes, your solution is correct because the all odd five-digit numbers are disjoint from all even five digit numbers. Jan 25, 2018 at 22:08
• Look's fine to me. Jan 25, 2018 at 22:08
• @amywhy that's what I was thinking too! thanks everyone
– fr14
Jan 25, 2018 at 22:09

You must be assuming that the numbers may be used repeatedly, else you would not have $5$ distinct digits that are all even. Yes? (That's the only way the question makes sense :))
If so, yes, your solution is correct because the all odd five-digit numbers are disjoint from all even five digit numbers. So the number strings of 5 odd digits, can be added to the number of strings of five even digits, to arrive at $5^5 + 4^5= 4149$ such strings in all. You are indeed correct.
Note: one could find the number of mixed strings (those with at least one odd and at least one even digit) by noting the number of all possible 5-digit strings is $9^5$ and subtracting your total for strictly odd and strictly even, to get $9^5 - (5^5+4^5) = 59049-4149=54900$ such strings.