Integers Containing a Zero
Among the positive integers from to , how many contain the digit at least once?
Work it out, then compare with the answer.
Answer
2620
SolutionShow the worked solution
Count the complement. A -digit positive integer with no digit has each of its digits chosen from . Every such string is a genuine -digit number, because its leading digit is not zero. So there are of them.
The integers from to are exactly the integers with one to four digits. The number contains a zero, so it is not zero-free. The number of zero-free integers in the range is therefore
Subtracting this from the integers in the range gives
Key idea. “At least one “ is awkward to count directly. ”No ” is easy if the numbers are split by length, because then the leading-digit restriction takes care of itself.