Skip to main content

AMC 12 Mock Exam 7 Problem 22

Problem 22 of 25

A landscaper plants 77 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 77 trees satisfy this requirement? (For example, with 44 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 nn in which every apple tree except possibly the last tree already has a birch neighbor, record the ending:

  • bnb_n: the last tree is B;   cnc_n: the last tree is C;
  • sns_n: the last tree is an A immediately after a B (already satisfied);
  • unu_n: the last tree is an A not immediately after a B (it still needs a B next).

Let gn=bn+cn+sng_n=b_n+c_n+s_n (the rows that are complete as they stand). Appending a tree gives bn+1=gn+un,cn+1=gn,sn+1=bn,un+1=cn+sn,b_{n+1}=g_n+u_n,\quad c_{n+1}=g_n,\quad s_{n+1}=b_n,\quad u_{n+1}=c_n+s_n, 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 (b1,c1,s1,u1)=(1,1,0,1)(b_1,c_1,s_1,u_1)=(1,1,0,1): n1234567bn1371951135359cn1261642112298sn01371951135un11392361163gn261642112298792\begin{array}{c|ccccccc} n&1&2&3&4&5&6&7\\\hline b_n&1&3&7&19&51&135&359\\ c_n&1&2&6&16&42&112&298\\ s_n&0&1&3&7&19&51&135\\ u_n&1&1&3&9&23&61&163\\\hline g_n&2&6&16&42&112&298&792 \end{array} A row of 77 trees is allowed exactly when it is counted by g7g_7, so the answer is 792\boxed{792}.

(Also counting rows that end in a pending A gives 792+163=955792+163=955. Requiring every A to be followed by a B gives 408408.)

Tagged: recursion for strings with a neighbor condition (forbidden isolated letter)