AMC 10 Step by Step
Printable problems

Recursive Counting

Counting via recurrences: tilings, Fibonacci-type, strings with no forbidden patterns

What you need to know

  • Setting up a recursion. Let ana_n be the count for size nn. Sort the objects by their last piece (the last tile, last letter, or last jump). Removing that piece leaves a smaller object, so ana_n is a sum of earlier terms.
  • Fibonacci-type recursions. Tilings of a 1×n1\times n board by 1×11\times1 squares and 1×21\times2 dominoes: the last piece is a square (leaving n−1n-1 cells) or a domino (leaving n−2n-2), so an=an−1+an−2a_n = a_{n-1}+a_{n-2}, with a1=1a_1 = 1 and a2=2a_2 = 2. Strings of 00s and 11s with no two 11s in a row follow the same rule, starting from a1=2a_1 = 2 and a2=3a_2 = 3. Example: tilings for n=1n = 1 to 66: 1,2,3,5,8,131, 2, 3, 5, 8, 13. Strings: 2,3,5,8,13,212, 3, 5, 8, 13, 21.
  • Avoiding longer patterns. Avoiding three in a row (say, no three heads in a row) gives a longer recursion such as an=an−1+an−2+an−3a_n = a_{n-1}+a_{n-2}+a_{n-3}. Or keep a separate count for each length of the run at the end (states).
  • When every earlier term appears. A recursion like an=an−1+an−2+⋯+a1+ca_n = a_{n-1}+a_{n-2}+\dots+a_1+c, where cc is a fixed number, doubles at every step from a2a_2 on, so its terms are powers of 22 times a fixed number. Why: subtracting the equation for an−1a_{n-1} from the one for ana_n leaves an−an−1=an−1a_n-a_{n-1} = a_{n-1}. Example: the number ana_n of ways to write nn as an ordered sum of positive whole numbers satisfies an=an−1+⋯+a1+1a_n = a_{n-1}+\dots+a_1+1 (the last part is 1,2,…,n−11, 2, \dots, n-1, or all of nn). So the counts are 1,2,4,8,⋯=2n−11, 2, 4, 8, \dots = 2^{n-1}.

How AMC 10 tests it

  • Problems 10–18: sequences of 88 to 1212 coin flips that avoid a pattern, or domino tilings of a 2×n2\times n board, meant for a recursion worked out by hand.
  • Problems 14–22: climbing stairs 11 or 22 steps at a time, or a frog jumping 11 or 22 lily pads with some pads not allowed.
  • Problems 18–24: a process defined step by step, where you must find a pattern or a formula.
  • Recursions also power many probability problems (see conditional probability and states).

Standard approaches

  1. Find what builds the object from a smaller one (usually the last piece or the first choice) and write ana_n from that.
  2. Set the starting values carefully (a0=1a_0 = 1, counting the empty object once, is often right). Then fill in a table up to the nn you need.
  3. If one recursion does not close up, keep two counts: for example, bnb_n for strings ending in 11 and cnc_n for strings ending in 00.
  4. If you cannot see the recursion, list small cases, guess the rule from the numbers, then explain why it holds.
  5. Check a tiling count with casework on the number of dominoes. With kk dominoes there are n−kn-k pieces, and (n−kk)\binom{n-k}{k} ways to choose which pieces are dominoes; add these up. Example: for n=5n = 5, (50)+(41)+(32)=1+4+3=8\binom50+\binom41+\binom32 = 1+4+3 = 8, matching a5a_5.

Worked example

How many sequences of 1010 coin flips contain no three consecutive tails?

(A) 274274 (B) 448448 (C) 504504 (D) 644644 (E) 927927

Solution.

Step 1: name the count. Let ana_n be the number of sequences of nn flips with no TTT in them. Call these "good."

Step 2: sort by the ending. A good sequence of length n≥3n\ge3 cannot end in TTT, so it ends in exactly one of H, HT, or HTT (its last H and the tails after it). Taking off that ending leaves any good sequence of length n−1n-1, n−2n-2, or n−3n-3. So an=an−1+an−2+an−3a_n = a_{n-1}+a_{n-2}+a_{n-3}.

Step 3: starting values. a0=1a_0 = 1 (the empty sequence), a1=2a_1 = 2, and a2=4a_2 = 4 (sequences this short cannot contain TTT).

Step 4: fill in the table. Each entry is the sum of the three before it. For example, a3=4+2+1=7a_3 = 4+2+1 = 7 (all 88 sequences except TTT).

nn334455667788991010
ana_n771313242444448181149149274274504504

Last, a10=274+149+81=504a_{10} = 274+149+81 = 504.

The answer is (C) 504\boxed{\textbf{(C)}\ 504}.

Pitfalls

  • Wrong starting values, especially a0a_0. One wrong value early on spoils the whole table.
  • Sorting by the ending in a way that misses some objects or counts some twice. "Ends in T" and "ends in TT" overlap: every sequence ending in TT also ends in T.
  • Arithmetic slips while filling in the table. Write every term, and add each one twice.
  • Assuming every "11 or 22" problem is plain Fibonacci without checking whether the pieces come in colors. With 1×11\times1 squares in 22 colors, the rule becomes an=2an−1+an−2a_n = 2a_{n-1}+a_{n-2}.

Traps that recur

  • Miscounting the free digits in the complement: each must be at least j, so there are 5 - j values for it, not 5 - j + 1 or 5. (2022 AMC 10A #24)
  • Writing the recurrence as Fibonacci (a_n = a_{n-1} + a_{n-2}) and getting a wrong count, or forgetting the block '110' and allowing '1110'. (2019 AMC 10B #25)
  • Treating the eight seats as a row (55 arrangements) and ignoring that the first and last people are also neighbors. (2015 AMC 10A #22)

Problems © Mathematical Association of America (MAA), American Mathematics Competitions. Reproduced for non-commercial educational use. The topic note, tags and key insights are original to this site.