Difference between revisions of "2015 AMC 12A Problems/Problem 22"

(Added problem.)
 
(Problem)
Line 4: Line 4:
  
 
<math> \textbf{(A)}\ 0\qquad\textbf{(B)}\ 4\qquad\textbf{(C)}\ 6\qquad\textbf{(D)}}\ 8\qquad\textbf{(E)}\ 10 </math>
 
<math> \textbf{(A)}\ 0\qquad\textbf{(B)}\ 4\qquad\textbf{(C)}\ 6\qquad\textbf{(D)}}\ 8\qquad\textbf{(E)}\ 10 </math>
 +
 +
==Solution==
 +
 +
One method the approach the problem is to find a recurrence for <math>S(n)</math>.
 +
 +
Let us define <math>A(n)</math> as the number of sequences of length <math>n</math> ending with an <math>A</math>, and <math>B(n)</math> as the number of sequences of length <math>n</math> ending in <math>B</math>. Note that <math>A(n) = B(n)</math> and <math>S(n) = A(n) + B(n)</math>, so <math>S(n) = 2A(n)</math>.
 +
 +
For a sequence of length <math>n</math> ending in <math>A</math>, it must be a string of <math>A</math>s appended onto a sequence of length <math>n-1, n-2, \text{or}\ n-3</math>. So we have the recurrence <cmath>A(n) = B(n-1) + B(n-2) + B(n-3) = A(n-1) + A(n-2) + A(n-3).</cmath>
 +
 +
We can thus begin calculating values of <math>A(n)</math>. We see that the sequence goes (starting from <math>A(0) = 1</math>): <math>1,1,2,4,7,13,24...</math>
 +
 +
A problem arises though - the values soon get to be far to large. Notice however, that we need only find <math>S(2015)\ \text{mod}\ 12</math>. In fact, we can abuse the fact that <math>S(n) = 2A(n)</math> and only find <math>A(2015)\ \text{mod}\ 6</math>. Going one step further, we need only find the period of <math>A(2015)\ \text{mod}\ 2</math> and <math>A(2015)\ \text{mod}\ 3</math> to find <math>A(2015)\ \text{mod}\ 6</math>.
 +
 +
Here are the values of <math>A(n)\ \text{mod}\ 2</math>, starting with <math>A(0)</math>: <cmath>1,1,0,0,1,1,0,0...</cmath>
 +
 +
Since the period is <math>4</math> and <math>2015 \equiv 3\ \text{mod}\ 4</math>, <math>A(2015) \equiv 0\ \text{mod}\ 2</math>.
 +
 +
Similarly, here are the values of <math>A(n)\ \text{mod}\ 3</math>,  starting with <math>A(0)</math>: <cmath>1,1,2,1,1,1,0,2,0,2,1,0,0,1,1,2...</cmath>
 +
 +
Since the period is <math>13</math> and <math>2015 \equiv 0\ \text{mod}\ 13</math>, <math>A(2015) \equiv 1\ \text{mod}\ 3</math>.
 +
 +
Knowing that <math>A(2015) \equiv 0\ \text{mod}\ 2</math> and <math>A(2015) \equiv 1\ \text{mod}\ 3</math>, we see that <math>A(2015) \equiv 4\ \text{mod}\ 6</math>, and <math>S(2015) \equiv 8\ \text{mod}\ 12</math>. Hence, the answer is <math>\textbf{(D)}</math>.

Revision as of 00:28, 5 February 2015

Problem

For each positive integer $n$, let $S(n)$ be the number of sequences of length $n$ consisting solely of the letters $A$ and $B$, with no more than three $A$s in a row and no more than three $B$s in a row. What is the remainder when $S(2015)$ is divided by 12?

$\textbf{(A)}\ 0\qquad\textbf{(B)}\ 4\qquad\textbf{(C)}\ 6\qquad\textbf{(D)}}\ 8\qquad\textbf{(E)}\ 10$ (Error compiling LaTeX. Unknown error_msg)

Solution

One method the approach the problem is to find a recurrence for $S(n)$.

Let us define $A(n)$ as the number of sequences of length $n$ ending with an $A$, and $B(n)$ as the number of sequences of length $n$ ending in $B$. Note that $A(n) = B(n)$ and $S(n) = A(n) + B(n)$, so $S(n) = 2A(n)$.

For a sequence of length $n$ ending in $A$, it must be a string of $A$s appended onto a sequence of length $n-1, n-2, \text{or}\ n-3$. So we have the recurrence \[A(n) = B(n-1) + B(n-2) + B(n-3) = A(n-1) + A(n-2) + A(n-3).\]

We can thus begin calculating values of $A(n)$. We see that the sequence goes (starting from $A(0) = 1$): $1,1,2,4,7,13,24...$

A problem arises though - the values soon get to be far to large. Notice however, that we need only find $S(2015)\ \text{mod}\ 12$. In fact, we can abuse the fact that $S(n) = 2A(n)$ and only find $A(2015)\ \text{mod}\ 6$. Going one step further, we need only find the period of $A(2015)\ \text{mod}\ 2$ and $A(2015)\ \text{mod}\ 3$ to find $A(2015)\ \text{mod}\ 6$.

Here are the values of $A(n)\ \text{mod}\ 2$, starting with $A(0)$: \[1,1,0,0,1,1,0,0...\]

Since the period is $4$ and $2015 \equiv 3\ \text{mod}\ 4$, $A(2015) \equiv 0\ \text{mod}\ 2$.

Similarly, here are the values of $A(n)\ \text{mod}\ 3$, starting with $A(0)$: \[1,1,2,1,1,1,0,2,0,2,1,0,0,1,1,2...\]

Since the period is $13$ and $2015 \equiv 0\ \text{mod}\ 13$, $A(2015) \equiv 1\ \text{mod}\ 3$.

Knowing that $A(2015) \equiv 0\ \text{mod}\ 2$ and $A(2015) \equiv 1\ \text{mod}\ 3$, we see that $A(2015) \equiv 4\ \text{mod}\ 6$, and $S(2015) \equiv 8\ \text{mod}\ 12$. Hence, the answer is $\textbf{(D)}$.