Since 8 does not occur in 1000, we have to count the number of times 8 occurs when we list the integers from 1 to 999. Any number between 1 and 999 is of the form xyz, where
Let us first count the numbers in which 8 occurs exactly once.
Since 8 can occur atone place in
ways. There are
such numbers.
Next, 8 can occur in exactly two places in
such numbers. Lastly, 8 can occur in all three digits in one number only.
Hence, the number of times 8 occur is