
2. Determine the number of 3-digit numbers in base 10 having at least one 5 and at most one 3.


## Solution

We count the number of 3-digit numbers with (i) at least one 5 and having no 3 and (ii) at least one 5 and having exactly one 3 separately.

(i) Here we first count the whole set and subtract the number of 3-digit numbers having no 5 from it. Since 3 is not there and 0 cannot be the first digit, we can fill the first digit in 8 ways. But we can fill the second and third digits in 9 ways(as 0 can be included). Thus we get $8 \times 9 \times 9$ such numbers. If no 5 is there, then the number of such numbers is $7 \times 8 \times 8$. Thus the number of 3-digit numbers not containing 3 and having at least one 5 is $(8 \times 9 \times 9)-(7 \times 8 \times 8)=8(81-56)=200$.

(ii) If 3 is there as a digit, then it can be the first digit or may be the second or third digit. Consider those numbers in which 3 is the first digit. The number of such numbers having at least one 5 is $(9 \times 9)-(8 \times 8)=81-64=17$. The number of 3 -digit numbers in which the second digit is 3 and having at least one 5 is $(8 \times 9)-(7 \times 8)=16$. Similarly, the number of 3-digit numbers in which the third digit is 3 and having at least one 5 is $(8 \times 9)-(7 \times 8)=16$. Thus we get $17+16+16=49$ such numbers.

Therefore the number of 3 -digit numbers having at most one 3 and at least one 5 is $200+49=$ 249 .
