AMC 12 Mock Exam 7 Problem 22
Problem 22 of 25
A landscaper plants trees in a row. Each tree is an apple tree, a birch tree, or a cedar tree. For pollination, every apple tree must be next to at least one birch tree (immediately to its left or immediately to its right). How many different sequences of trees satisfy this requirement? (For example, with trees, the sequences ACBB and CBAA are not allowed, but ABAC and CCBA are.)
Answer choices
Show solution
Solution
Write A, B, C for the three kinds of tree, and build the row from left to right. For a row of length in which every apple tree except possibly the last tree already has a birch neighbor, record the ending:
- : the last tree is B; : the last tree is C;
- : the last tree is an A immediately after a B (already satisfied);
- : the last tree is an A not immediately after a B (it still needs a B next).
Let (the rows that are complete as they stand). Appending a tree gives because after a pending A only a B may come, a B satisfies a pending A, and a new A is satisfied on its left exactly when it follows a B. Starting from : A row of trees is allowed exactly when it is counted by , so the answer is .
(Also counting rows that end in a pending A gives . Requiring every A to be followed by a B gives .)
Tagged: recursion for strings with a neighbor condition (forbidden isolated letter)