Call a positive integer an uphill integer if every digit is strictly greater than the previous digit. For example, , , and are all uphill integers, but , , and are not. How many uphill integers are divisible by ?
- A)
- B)
- C)
- D)
- E)
Answer
C
Key insight
Uphill numbers cannot end in 0, so a multiple of 5 ends in 5. Then choose digits from 1 to 4 so the digit sum is a multiple of 3.
Solution
A number is divisible by exactly when it is divisible by both and . Handle first, because it pins down the last digit.
Step 1: divisible by 5.
- The last digit must be or .
- In an uphill number the last digit is the biggest digit. A can never be the biggest, so the last digit is .
- Every other digit is smaller than , and cannot come first, so the other digits come from . Once you choose which of those digits to use, there is only one uphill order for them. So an uphill number ending in is just "a choice of some of the digits , then a ."
Step 2: divisible by 3.
- The digit sum must be a multiple of . The already adds , so the chosen digits must add up to , , or (then the total is , , or ). The largest possible sum is , so we can stop there.
- List the choices:
| chosen digits add to | choices | numbers |
|---|---|---|
| ; | , | |
| ; | , | |
- (Choosing no extra digits gives just , whose digit sum is not a multiple of .)
- That is numbers: .
The answer is .
Why this works
Because the digits must go up, an uphill number is decided entirely by which digits it uses. So counting uphill numbers is really counting choices of digits. The divisibility rules for and then become simple rules about those digits: the largest is , and the sum is a multiple of .
The trap
Counting numbers that end in 0, such as 120 or 1230. They are not uphill, because 0 is smaller than the digit before it.
Concise solution
Divisible by means divisible by and by .
Divisible by 5. The last digit is or . In an uphill integer the last digit is the largest digit, so it cannot be . Hence the number ends in , and its earlier digits form an increasing string chosen from (a leading is not allowed).
Divisible by 3. The digit sum must be a multiple of . The chosen subset of must have sum (since ). Listing subsets by sum:
- sum : , sum : , sum : , sum : .
Those six subsets give the numbers , all multiples of . (The empty subset gives , not divisible by .)
The answer is .
Review in the AoPS books
- Introduction to Number Theory, Chapter 1: Integers: The Basics (§1.4, §1.5)
- Introduction to Number Theory, Chapter 8: Base Numbers
- Introduction to Counting & Probability, Chapter 1: Counting Is Arithmetic
- Prealgebra, Chapter 15: Problem-Solving Strategies (§15.2)
Techniques
Organized listing / direct enumeration