A child climbs a 12-step staircase, each move going up exactly 1, 2 or 3 steps, ending exactly on the top step. To stay safe, the child never makes two 3-step moves in a row. How many different sequences of moves are possible?
Enter an integer
Show solution
Let an be the number of valid ways to climb n steps whose last move is not a 3 (count the empty climb as a0=1), and bn those ending in a 3. A 3-move may only follow a non-3 ending, so bn=an−3, while an=(an−1+bn−1)+(an−2+bn−2). Tabulating (an,bn) for n=1..12: (1,0),(2,0),(3,1),(6,1),(11,2),(20,3),(36,6),(65,11),(118,20),(214,36),(388,65),(703,118). Total for 12 steps: 703+118=821.