Call a positive integer if it is a one-digit number or its digits, when read from left to right, form either a strictly increasing or a strictly decreasing sequence. For example, , , and are monotonous, but , , and are not. How many monotonous positive integers are there?
- A)
- B)
- C)
- D)
- E)
Answer
B
Key insight
Choosing a set of different digits gives exactly one increasing number and one decreasing number. Count digit sets: 511 increasing, 1022 decreasing, minus the 9 one-digit numbers counted twice.
Solution
Start with an example. The digit set gives exactly one increasing number, , and exactly one decreasing number, . The digits of a monotonous number are all different, and once you know which digits are used, the order is forced. So count sets of digits instead of numbers.
- Increasing numbers. The digit cannot be used: in an increasing number it would have to come first. So the digits come from to . Each of these digits is either in or out, giving sets, and we throw away the empty set: numbers.
- Decreasing numbers. Now is allowed, because it goes last (as in ). The digits come from to : sets. Throw away the empty set, and also the set alone, which would give the number , not a positive integer. That leaves numbers.
- Counted twice. The one-digit numbers to appear in both lists. A number with two or more digits cannot be both increasing and decreasing, so nothing else is repeated. That is repeats.
- Total: .
The answer is .
Why this works
When the order of the objects is forced (smallest to largest, or largest to smallest), counting arrangements is the same as counting which objects are chosen, and "in or out" for each digit gives powers of . The only care needed is at the edges: where the digit may go, and which numbers belong to both lists.
The trap
Forgetting that 0 can end a decreasing number (like 987620), or counting the one-digit numbers 1 to 9 twice.
Concise solution
A strictly increasing or strictly decreasing number is determined by its set of digits: sort the set one way or the other. So count digit sets.
Increasing numbers: the digits are distinct and cannot appear (it would have to come first). Any nonempty subset of works: numbers.
Decreasing numbers: any nonempty subset of , written largest to smallest, gives a valid positive integer, except the subset alone. That is numbers.
Overlap: the one-digit numbers through appear in both lists ( numbers). Nothing else does, since a number with two or more digits cannot be both increasing and decreasing.
Total: .
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
- Intermediate Counting & Probability, Chapter 4: Constructive Counting and 1-1 Correspondences (§4.4, §4.5, §4.6)
- Introduction to Counting & Probability, Chapter 2: Basic Counting Techniques (§2.2)
Techniques
Map the objects to something easier to count · Split into exhaustive cases and handle each