How many -digit positive integers (that is, integers between and , inclusive) having only even digits are divisible by
- A)
- B)
- C)
- D)
- E)
Answer
B
Key insight
The last digit must be 0 (even and divisible by 5). The first digit has 4 choices, since it cannot be 0, and each middle digit has 5.
Solution
Count digit by digit, starting with the digit that has the strictest rule.
1. Last digit. A number is divisible by when its last digit is or . The digit must also be even, and is odd. So the last digit must be : choice.
2. First digit. It must be even, and a -digit number cannot start with . So it is , , or : choices.
3. Second and third digits. Each can be any even digit : choices each.
4. The choices do not affect each other, so multiply:
For example, , and are all counted.
The answer is .
Why this works
When each digit's choices do not depend on the others, the total count is the product of the number of choices for each digit. Settle the most restricted spots first (here the last digit is forced), and always remember that the first digit of a number cannot be .
The trap
Letting the first digit be 0 (5 choices, giving 125), or forgetting that 5 is odd and allowing it as the last digit (giving 200).
Concise solution
A number is divisible by exactly when its last digit is or . Since every digit must be even, the last digit is forced to be : one choice.
The thousands digit must be even and nonzero: , four choices.
The hundreds and tens digits may be any even digit : five choices each.
By the multiplication principle the count is
The answer is .
Review in the AoPS books
- Introduction to Counting & Probability, Chapter 1: Counting Is Arithmetic
- Introduction to Number Theory, Chapter 8: Base Numbers
- Introduction to Number Theory, Chapter 1: Integers: The Basics (§1.4, §1.5)
- Introduction to Counting & Probability, Chapter 2: Basic Counting Techniques
Techniques
Set up the equation/formula and compute; no special trick needed