2025 AMC 10A Problem 24
Call a positive integer fair if no digit is used more than once, it has no 0s, and no digit is adjacent to two greater digits. For example, , , and are fair, but , , and are not fair. How many fair positive integers are there?
Show solution without answering
Key insight
A fair number's digits climb to the largest digit, then fall. Once the digits are chosen, every digit except the largest just picks the left or right side.
Solution
Step 1: understand the rule.
- A fair number uses digits from to , each at most once. The third rule says no digit may sit in a "valley", with a bigger digit on both sides. A digit at either end has only one neighbour, so an end digit is never a problem.
2. Try a small case to see the pattern. With the digits there are six orders:
- , , , are fair;
- and are not, because the sits between two bigger digits.
In every fair one, the digits climb up to (the largest) and then go down.
Step 2: fair means "up, then down".
- If the digits climb to the largest digit and then fall, there is no valley. Every digit before the top has a smaller digit on its left, every digit after the top has a smaller digit on its right, and the top digit is bigger than both of its neighbours.
- If the digits ever go down and then later go up again, there is a valley. Follow the digits from where they start going down to where they first turn back up. The digit at that turning point has a bigger digit on its left (the digits were going down) and a bigger digit on its right (they go up again). For example, in the digits go down from to and then up to , and is the valley.
- So a number is fair exactly when its digits climb to the largest digit and then fall.
Step 3: count the orders of a fixed set of digits.
- Pick a set of different digits. The largest one has to sit at the top. Each of the other digits goes either on the left (climbing) side or on the right (falling) side.
- Once each digit has picked its side, the order is forced: the left side must be in increasing order and the right side in decreasing order.
- Each of the digits has choices, so a set of digits gives fair numbers. Check with : , matching the four fair numbers above.
Step 4: add up over all digit sets.
- The number of ways to choose digits out of is . Multiply by and add:
| ways to choose the digits | orders | fair numbers | |
|---|---|---|---|
| 1 | |||
| 2 | |||
| 3 | |||
| 4 | |||
| 5 | |||
| 6 | |||
| 7 | |||
| 8 | |||
| 9 |
- The total is .
(Quick check on the row: every two-digit number with two different nonzero digits is fair, and there are of them.)
The answer is .
Why this works
A rule about neighbours ("no valleys") often turns out to be a rule about the overall shape ("up, then down"). Once you see the shape, counting splits into two easy steps: choose which digits to use, then count the ways to arrange them. The largest digit has no choice about where it goes, and that is why each set gives and not .
Alternative approach
Here is a way to count everything at once. Give each digit to one of three labels: not used, left, or right. That is ways to label.
- Every labelling except "all not used" builds a fair number: write the left digits in increasing order, then the right digits in decreasing order.
- Each fair number gets built exactly twice, because its largest digit can be labelled left or right and the number comes out the same.
So , and the number of fair numbers is .
Concise solution
A shorter write-up, the way contest solutions are usually written. It may take a different route from the solution above.
The first two conditions say the digits form a sequence of distinct elements of , so a fair number uses a subset of size for some , and no leading-zero worry arises. The third condition says no interior digit has both of its neighbours larger — that is, no interior digit is a local minimum. (End digits have only one neighbour, so they are never at fault.)
Step 1: the shape of a fair number. A string of distinct digits has no interior local minimum exactly when it increases up to its largest digit and then decreases.
One direction is immediate: in a string , every digit before the peak has a smaller digit on its left, every digit after the peak has a smaller digit on its right, and the peak is larger than both neighbours, so nothing is a local minimum.
Conversely, suppose the string is not of that shape. Then somewhere it goes down and later comes back up: there is a descent followed by an ascent with . Take the first ascent after that descent; then , so while , and position is an interior local minimum. So the number is not fair.
Step 2: count the orderings of a fixed digit set. Fix a set of digits. Its largest element must sit at the peak. Each of the other digits is assigned to the increasing run (left of the peak) or the decreasing run (right of the peak); once the sides are chosen, the order within each run is forced, since the left run must be increasing and the right run decreasing. Different side-assignments give different strings, so there are exactly
fair numbers using that digit set. Sanity check with and digits : the four strings are , , , , while and both have the trapped between two larger digits.
Step 3: sum over all digit sets.
(Quick checks: gives one-digit numbers, and gives , which is every two-digit number with distinct nonzero digits, as it should be — no two-digit number can fail the adjacency rule.)
The answer is .
Review in the AoPS books
- Introduction to Counting & Probability, Chapter 1: Counting Is Arithmetic
- Introduction to Counting & Probability, Chapter 2: Basic Counting Techniques (§2.5)
- Intermediate Counting & Probability, Chapter 4: Constructive Counting and 1-1 Correspondences (§4.4, §4.5, §4.6)
- Introduction to Algebra, Chapter 11: Special Factorizations
Similar problems
Problem © Mathematical Association of America (MAA), American Mathematics Competitions. Reproduced for non-commercial educational use. Solution and commentary are original to this site.