How many of the base-ten numerals for the positive integers less than or equal to contain the digit ?
- A)
- B)
- C)
- D)
- E)
Answer
A
Key insight
Count numbers with no zero digit (9, 81, 729 for 1 to 3 digits, 729 for 1000-1999, none for 2000-2017) and subtract from 2017.
Solution
Count the complement: integers from to with no digit equal to . Each digit can then be any of through .
- One-digit numbers: .
- Two-digit numbers: .
- Three-digit numbers: .
- Four-digit numbers from to : leading digit , then choices for the rest.
- Four-digit numbers from to : every one has a in the hundreds place, so zero-free numbers.
Zero-free total: .
Numbers containing a : .
The answer is .
Why this works
"Contains at least one " is hard to count directly because a number may contain several zeros; "contains no " is a clean product of independent digit choices. Splitting by digit length handles the leading-digit restriction, and the awkward tail to is checked separately rather than forced into a formula.
The trap
Forgetting that every number from 2000 to 2017 contains a 0, or allowing 0 as a leading digit in the no-zero count.
Common mistakes
- Forgetting that every number from 2000 to 2017 contains a 0, or allowing 0 as a leading digit in the no-zero count.
- Counting directly by position of the zero and double counting numbers such as or that have two zeros.
Techniques
Count the complement and subtract from the total