Hi Nancy,
Since 8 is not allowed:
for the ten thousands place, there are 8 possible digits (can't have zero since then not a 5digit number
for the remaining places, there are 9 possible digits.
Case 1
Suppose there is exactly one 5 in the number.
This could be located in the ten thousands place, and each remaining place has 91=8 possibilities (5 not allowed since exactly one 5). So there are 8x8x8x8 possibilities.
The one 5 could be located in the thousands place. Now there 7 possibilites for the ten thousands place and 8 possibilities for the remaining places. So there are 7x8x8x8 possibilities.
Similarly, there are 7x8x8x8 possibilities for each of hundreds, tens and ones place for the location of the 5.
Thus, for this case, the total number of possibilities is:
8x8x8x8 + 4x(7x8x8x8).
Case 2 
Suppose there are exactly two 5's in the number.
Using similar reasoning as in case one, the total number of possibilities is:
4x(8x8x8) + 6x(7x8x8)
(The first addend counts the number possibilities when one 5 is in the ten thousands place, and the second addend counts the number possibilities when the ten thousands place is not a 5.)
Case 3 
Suppose there are exactly three 5's in the number.
Using similar reasoning as above, the total number of possibilities is:
6x(8x8) + 4x(7x8)
Case 4 
Suppose there are exactly four 5's in the number.
Using similar reasoning as above, the total number of possibilities is:
4x(8) + 1x(7)
Case 5 
Suppose there are exactly five 5's in the number.
The total number of possibilities is 1.
Hence, adding all five cases, the total is:
18432 + 4736 + 608 + 39 + 1 = 23816
Paul
