Direct answer. For many AIME recurrence relations, the fastest route is not to compute hundreds of terms. If a recurrence uses the previous two terms modulo m, record the ordered state pair (an-1, an). Because the pair determines every later term, the sequence must eventually repeat a state. Find the first return of the initial pair when it occurs (otherwise separate any tail from the cycle), call the cycle length p, reduce the target index modulo p, and compute only the needed residue. This is a strategy lesson, not a claim about one official contest question.
Why long expansion is usually the wrong first move
A recurrence such as an = an-1 + an-2 modulo 7 looks harmless for the first ten terms. By the two-hundredth term, hand expansion becomes slow and error-prone. If the target is a2027, expanding is even worse. The exam setting rewards structure: identify what controls the future, prove that a cycle must occur, then jump to the required index.
This is also where careless work appears. Students often compute a correct list but lose the index count, reduce the wrong starting index, or assume a period before checking that the state has actually returned. A good solution separates three tasks: find the cycle, compute the remainder, and verify the final value against the recurrence.
The same state idea appears in modular arithmetic problems where only remainders matter. If you want more practice with that family, the site's AIME Modular Arithmetic: Recover an Integer From Two Remainders is a useful companion because the period method depends on clean residue computation.
The state-pair method in four moves
- Write the state. For a second-order recurrence, the state at step n is the ordered pair (an-1, an). The order matters: (2,5) and (5,2) are different states.
- Generate pairs, not just terms. Compute an+1, then record the new pair (an, an+1). Keep a table with columns for n, an, and the current pair.
- Stop when the initial pair returns. If the pair at n = 1 is (a0, a1) and the same pair appears at n = p + 1, then the sequence repeats every p indices from the start.
- Reduce the target index. For aN, compute N modulo p. Use the remainder to choose a small term from the verified cycle. Do not round the remainder or shift the index unless the sequence is indexed from a1.
There is a guaranteed bound worth remembering. For modulus m, a second-order recurrence has at most m2 possible ordered pairs. Therefore a repeat must occur within m2 + 1 states. The actual period can be much shorter, so the bound is a safety net, not a target. For modulus 1000, there are one million possible pairs, so the guaranteed repeat bound is just over one million states, which is too large for hand work; in contest problems, the useful discovery is usually a much smaller cycle or a structural shortcut.

Worked teaching illustration: Fibonacci modulo 7
Teaching illustration only, not a past AIME problem. Define a0 = 0, a1 = 1, and an = an-1 + an-2 modulo 7 for n at least 2. Find a2027.
Compute terms modulo 7: 0, 1, 1, 2, 3, 5, 1, 6, 0, 6, 6, 5, 4, 2, 6, 1, 0, 1. At n = 1 the state is (0,1). At n = 17 the state is (a16, a17) = (0,1), the same pair. The gap between matching states is 16, so the sequence has period 16 from the start.
Now reduce the large index: 2027 = 16 × 126 + 11, so 2027 modulo 16 is 11. Therefore a2027 = a11 = 5. The key check is not just that a17 = 1; the state pair must match, because the pair controls the next term.
A second teaching illustration with a different modulus
Teaching illustration only, not a past AIME problem. Let b0 = 0, b1 = 1, and bn = 2bn-1 + bn-2 modulo 5. Compute b2026.
The terms begin 0, 1, 2, 0, 2, 4, 0, 4, 3, 0, 3, 1, 0, 1. The initial state at n = 1 is (0,1). At n = 13 the state is (b12, b13) = (0,1), so the period is 12. Since 2026 = 12 × 168 + 10, the target index reduces to 10. Thus b2026 = b10 = 3.
| Teaching recurrence | Modulus | Pair bound m2 | Period found | Index reduction | Result |
|---|---|---|---|---|---|
| Fibonacci: an = an-1 + an-2 | 7 | 49 | 16 | 2027 mod 16 = 11 | a2027 = 5 |
| bn = 2bn-1 + bn-2 | 5 | 25 | 12 | 2026 mod 12 = 10 | b2026 = 3 |
Index conversion and off-by-one traps
The most common AIME recurrence error is a one-index shift. If a sequence starts at a0 and a state repeats at n = 1 and n = 17, the period is 16. That means an+16 = an for every n in the cycle. It does not mean a17 = a1 is enough by itself; the whole state must match.
If a sequence starts at a1, convert carefully. Suppose the first two terms are a1 and a2, and the state repeats after p steps. Then an+p = an for n at least 1. To reduce aN, compute (N − 1) modulo p, then add 1. Skipping that adjustment can move the answer by one term, which is fatal when the final answer must be a single integer.
Write the index convention at the top of your scratch work. A clean habit is to make a small table with three columns: index n, term an, and state. When the state returns, mark the first occurrence and the return occurrence. The difference is the period, while the term values alone do not prove periodicity.
What if the first repeated pair is not the starting pair?
Some recurrences have a short tail before the cycle begins. The state method still works, but the reduction changes. Record the first occurrence of each state. If a state first appears at step r and next appears at step s, then the cycle length is s − r, with the first occurrence at step r marking the start of the cycle. For a target index N beyond the preperiod, reduce N − r modulo the cycle length, then add r.
Do not automatically assume that every repeating sequence is periodic from the initial pair. That assumption is only safe after the initial state itself has returned. For many contest recurrences the cycle starts immediately, but a careful solution states why. The state-pair table gives you the evidence, not a guess.
How to check a period claim before trusting it
First, check that two consecutive terms match the starting pair. If the recurrence depends on the previous two terms, matching only one term is not enough. Second, check that the return is the first return of that state; otherwise you may have found a multiple of the true period. Third, recompute the reduced index directly from the table. A final value should satisfy the original recurrence when you step one term forward and one term backward where possible.
This checking habit is the same one used in other integer-answer settings: verify the condition that defines the answer, not just the arithmetic that produced it. The site's AIME Answer Checking: Catching Extraneous Roots Before Recording an Integer guide is relevant because recurrence questions often fail at the final integer, after the hard structure has already been found.
A practical practice routine for AIME recurrence relations
Use short, repeatable drills rather than long random expansion.
- Five-minute warm-up. Choose a modulus from 3 to 9 and a second-order recurrence. Build the state table until the initial pair returns. Write the period and one sentence explaining why the return proves repetition.
- Index drill. Ask for three targets: one small, one exactly on a period boundary, and one just after a boundary. This exposes off-by-one errors immediately.
- No-calculator residue practice. Reduce the target modulo the period by hand. Keep the quotient and remainder visible so the reduction can be audited.
- Error review. When an answer is wrong, classify the error as state error, period error, index error, or arithmetic error. Recurrence practice improves fastest when the error type is named.
- Timed set. After accuracy is stable, practise choosing quickly between direct computation and period discovery. This is a pacing decision as much as a mathematical one. The site's AIME Pacing Practice: Prepare for Your Region's 2027 Format guide supports that broader training choice.
How preparation support should respond
A useful recurrence lesson should ask the student to explain why the state pair determines the future, not merely to memorise a period. A Hanlin Course teacher profile published 25 October 2024 describes a coaching preference for guided reasoning and independent thinking rather than answer routines. Applied here, that means the teacher should ask: what information is needed to compute the next term, what would make the sequence repeat, and how do we know the repeat is the first one? Those questions transfer to unfamiliar recurrences.
Parents deciding on preparation support can look for worked solutions that show the state table, the period claim, and the index reduction in that order. A page that only lists terms and announces a period is less useful than one that exposes the logic. The goal is not to make every recurrence look the same; it is to build a reliable first move when the sequence is long, the modulus is fixed, and the answer must be an integer.
For independent practice, keep a one-page template: recurrence, modulus, starting state, first return, period, target reduction, final check. Fill it in for several small moduli before attempting a long-index problem. The template turns a messy expansion into a short, auditable argument.
General event background is available at Event background.

Frequently Asked Questions
What does period mean in an AIME recurrence relation?
It is the number of steps after which the controlling state returns to an earlier state. For a second-order recurrence, the state is the ordered pair of the previous two terms. If the initial pair returns after p steps, the sequence repeats every p indices from that point.
Do I need to prove that a recurrence is periodic?
For a finite modulus, a repeat of some state is guaranteed because only finitely many ordered pairs exist. In a written solution, show the state table and identify the first repeated state. If the initial pair returns, that proves a period from the start; if a later state repeats first, record the tail and cycle separately.
What if the recurrence uses three previous terms?
Use a three-term state instead of a two-term pair. The same logic applies: the state determines all future terms, so a repeat gives a cycle. The state-space bound becomes m cubed, so the bound is larger, but the method is unchanged.
