2015 AMC 12B Problems/Problem 20

Revision as of 19:35, 9 December 2020 by Smileymittens (talk | contribs) (Solution)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Problem

For every positive integer $n$, let $\text{mod}_5 (n)$ be the remainder obtained when $n$ is divided by 5. Define a function $f: \{0,1,2,3,\dots\} \times \{0,1,2,3,4\} \to \{0,1,2,3,4\}$ recursively as follows:

\[f(i,j) = \begin{cases}\text{mod}_5 (j+1) & \text{ if } i = 0 \text{ and } 0 \le j \le 4 \text{,}\\ f(i-1,1) & \text{ if } i \ge 1 \text{ and } j = 0 \text{, and} \\ f(i-1, f(i,j-1)) & \text{ if } i \ge 1 \text{ and } 1 \le j \le 4. \end{cases}\]

What is $f(2015,2)$?

$\textbf{(A)}\; 0 \qquad\textbf{(B)}\; 1 \qquad\textbf{(C)}\; 2 \qquad\textbf{(D)}\; 3 \qquad\textbf{(E)}\; 4$

Solution 1

Simply take some time to draw a table of values of $f(i,j)$ for the first few values of $i$:

\[\begin{array}{|c || c | c | c | c | c |} \hline i \text{\ \textbackslash\ } j & 0 & 1 & 2 & 3 & 4\\ \hline\hline 0 & 1 & 2 & 3 & 4 & 0\\ \hline 1 & 2 & 3 & 4 & 0 & 1\\ \hline 2 & 3 & 0 & 2 & 4 & 1\\ \hline 3 & 0 & 3 & 4 & 1 & 0\\ \hline 4 & 3 & 1 & 3 & 1 & 3\\ \hline 5 & 1 & 1 & 1 & 1 & 1\\ \hline \end{array}\]

Now we claim that for $i \ge 5$, $f(i,j) = 1$ for all values $0 \le j \le 4$. We will prove this by induction on $i$ and $j$. The base cases for $i = 5$, have already been proven.

For our inductive step, we must show that for all valid values of $j$, $f(i, j) = 1$ if for all valid values of $j$, $f(i - 1, j) = 1$.

We prove this itself by induction on $j$. For the base case, $j=0$, $f(i, 0) = f(i-1, 1) = 1$. For the inductive step, we need $f(i, j) = 1$ if $f(i, j-1) = 1$. Then, $f(i, j) = f(i-1, f(i, j-1)).$ $f(i, j-1) = 1$ by our inductive hypothesis from our inner induction and $f(i-1, 1) = 1$ from our outer inductive hypothesis. Thus, $f(i, j) = 1$, completing the proof.

It is now clear that for $i \ge 5$, $f(i,j) = 1$ for all values $0 \le j \le 4$.

Thus, $f(2015,2) = \boxed{\textbf{(B)} \; 1}$.

Solution 2

We are given that \[f(0,n) \equiv n+1\pmod{5} .\] Then, $f(1,n) = f(0, f(1, n-1)) \equiv f(1,n-1) + 1\pmod{5}$. Thus $f(1,n) \equiv n+f(1,0)\pmod{5}$. Since $f(1,0)=f(0,1)=2$, we get \[f(1,n) \equiv n+2\pmod{5} .\] Then, $f(2,n) = f(1, f(2, n-1)) \equiv f(2,n-1) + 2\pmod{5}$. Thus $f(2,n) \equiv 2n+f(2,0)\pmod{5}$. Since $f(2,0)=f(1,1)=3$, we get \[f(2,n) \equiv 2n+3\pmod{5} .\] Now $f(3,n) = f(2, f(3, n-1)) \equiv 2f(3,n-1) + 3\pmod{5}$. Thus \begin{align*}     f(3,n) &\equiv 2f(3,n-1) + 3 &\pmod{5} \\     2f(3,n-1) &\equiv 2^2f(3,n-2) + 3\cdot 2 &\pmod{5} \\     \vdots \qquad &\quad\vdots \quad\qquad \vdots \qquad\qquad \vdots &\\     2^{n-1}f(3,1) &\equiv 2^nf(3,0) + 3\cdot 2^{n-1} &\pmod{5}  \end{align*} Adding them all up we get \[f(3,n) \equiv 3(2^n-1)\pmod{5} .\] This means that $f(3,0)=0$, $f(3,1)=3$, $f(3,2)=4$, $f(3,3)=1$, and $f(3,4)=0$. Thus $f(3,n)$ never takes the value 2.

Since $f(4,n)=f(3,f(4,n-1))$, this implies that $f(4,n) \neq 2$ for any $n$. By induction, $f(3,n) \neq f(3,2) = 4$ for any $n$. It follows that $f(3,n) \neq f(3,4) = 0$ for any $n$. Thus $f(4,n)$ only takes values in $\{1,3\}$. In fact, it alternates between 1 and 3: $f(4,0)=f(3,1)=3$, then $f(4,1)=f(3,f(4,0))=f(3,3)=1$, then $f(4,2)=f(3,f(4,1))=f(3,1)=3$, and so on.

Repeating the argument above, we see that $f(5,n) = f(4, f(5,n-1))$ can only take values in $\{1,3\}$. However, $f(5,n-1)\neq 0$ for any $n$ implies that $f(5,n)\neq f(4,0)=3$ for any $n$. Thus $f(5,n)=1$ for all $n$. We can easily verify this: $f(5,0)=f(4,1)=1$, then $f(5,1)=f(4,f(5,0))=f(4,1)=1$, then $f(5,2)=f(4,f(5,1))=f(4,1)=1$, and so on.

Then $f(6,0)=f(5,1)=1$. Moreover, $f(6,n) = f(5,f(6,n-1)) = 1$ for all $n$. Continuing in this manner we see that $f(m,n)=1$ for all $m\ge 5$.

In particular, $f(2015,2) = \boxed{\textbf{(B)} \; 1}$.

See Also

2015 AMC 12B (ProblemsAnswer KeyResources)
Preceded by
Problem 19
Followed by
Problem 21
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
All AMC 12 Problems and Solutions

The problems on this page are copyrighted by the Mathematical Association of America's American Mathematics Competitions. AMC logo.png