2015 AMC 12A Problem 22

Attempt Problem 22 of the 2015 AMC 12A below, then check your answer against the professionally curated solution from LIVE by Po-Shen Loh. You can also try the full timed exam, view all 2015 AMC 12A solutions, or check the answer key.

All problems are used with official legal permission of the Mathematical Association of America (MAA).

22.

For each positive integer n,n, let S(n)S(n) be the number of sequences of length nn consisting solely of the letters AA and B,B, with no more than three AAs in a row and no more than three BBs in a row. What is the remainder when S(2015)S(2015) is divided by 12?12?
00
44
66
88
1010
Answer: D
Concepts:recursive countingmodular arithmeticChinese Remainder Theorem
Small hint:
A valid sequence ends in a run of 1,1, 2,2, or 33 equal letters, giving S(n)=S(n−1)S(n) = S(n-1) +S(n−2)+ S(n-2) +S(n−3)+ S(n-3)
Big hint:
Reduce the recurrence modulo 33 and modulo 44 separately to find its period
Solution:
Note S(1)=2,S(1) = 2, S(2)=4,S(2) = 4, S(3)=8.S(3) = 8. Every valid sequence ends in a run of one, two, or three equal letters; removing that run leaves a valid sequence of length n−1,n-1, n−2,n-2, or n−3.n-3. Thus S(n)=S(n−1)+S(n−2)+S(n−3). \begin{aligned} &S(n) = S(n-1) + S(n-2) \\ &\quad {}+ S(n-3). \end{aligned}
Modulo 3,3, the first 1313 terms are 2,1,2,2,2,0,1,0,1,2,0,0,2.2,1,2,2,2,0,1,0,1,2,0,0,2. The next three terms are 2,1,2,2,1,2, which reproduce the initial state, so the recurrence repeats with period 13.13. Since 2015=13⋅155,2015 = 13\cdot 155, it follows that S(2015)≡S(13)≡2(mod3).S(2015) \equiv S(13) \equiv 2 \pmod 3.
Modulo 4,4, the terms repeat as 2,0,0,2,2,0,0,2, because the next three-term state after these four terms is again (2,0,0).(2,0,0). Thus the period is 4.4. As 2015=4⋅503+3,2015 = 4\cdot 503 + 3, we have S(2015)≡S(3)≡0(mod4).S(2015) \equiv S(3) \equiv 0 \pmod 4.
Writing S(2015)=4k,S(2015) = 4k, the condition 4k≡2(mod3)4k \equiv 2 \pmod 3 gives k≡2(mod3),k \equiv 2 \pmod 3, so S(2015)≡8(mod12).S(2015) \equiv 8 \pmod{12}.
Thus, the correct answer is D.
LIVE by Po-Shen Loh
Programs

LIVE Classes

Self-Paced Classes

Stars

Scholarship

About Us

Who Is Po-Shen Loh?

Email Contact

Newsletter

Jobs

Become a Star

For a more Thought Full world.

© 2026 Expii, Inc.