# Mock AIME II 2012 Problems/Problem 2

## Problem

Let $\{a_n\}$ be a recursion defined such that $a_1=1, a_2=20$, and $a_n=\sqrt{\left| a_{n-1}^2-a_{n-2}^2 \right|}$ where $n\ge 3$, and $n$ is an integer. If $a_m=k$ for $k$ being a positive integer greater than $1$ and $m$ being a positive integer greater than 2, find the smallest possible value of $m+k$.

## Solution

The sequence goes as follows: $1, 20, \sqrt{399}, 1, \sqrt{398}, \sqrt{397}, 1, \sqrt{396}, \sqrt{395}, 1, \cdots$ Note that this sequence repeats, because once we get to $1$, we subtract $1$ from the number under the square root sign and take the square root of that, then when you take the difference of the squares of these two numbers, they have a difference of $1$, so you get back to $1$.

The first perfect square less than $20^2$ is $19^2=361$. Therefore $k=\sqrt{361}=19$.

We present three ways to finding $m$:

Way 1: Now notice that, for $n\equiv1(\bmod3)$, we have $a_n=1$. Also, the terms under the radical counts down one for every $a_n$ such that $a_n\not\equiv1(\bmod3 )$. The number of $n\equiv1(\bmod 3)$ before a number $n$ can be seen to be $\lceil \frac{n}{3}\rceil$. Therefore, we can see that $a_n=\sqrt{401-n+\lceil\frac{n}{3}\rceil}$. Setting this equal to $19$, we see that $n-\lceil\frac{n}{3}\rceil=40$. We can see that both $n=60$ and $n=61$ satisfy this, however, since $61\equiv1(\bmod3)$, we disregard this, and we find that $a_{60}=19$, so $m=60$.

Way 2: Look at the sequence by grouping terms as follows: $1, (20, \sqrt{399}, 1), (\sqrt{398}, \sqrt{397}, 1), (\sqrt{396}, \sqrt{395}, 1), \cdots (\sqrt{362}, \sqrt{361}, 1)$. Note that the number of these groups of three that we have is equal to the number of terms in the sequence $(361, 363, 365, \cdots 399)$. This has $\frac{399-359}{2}=20$ terms in it. Before the last group, we have $19*3+1=58$ terms, and $\sqrt{361}$ is therefore the $60$th term, and $m=60$.

Both ways lead to $m=60$ and $k=19$, so the answer is $60+19=\boxed{79}$.

To show that no smaller sums can be created, note that the next perfect square will be $k=18$ and will take more than $60+(19^2-18^2)=97$ as the value of $m$, and hence all other perfect squares will take more than $97$, and we have $97+k$ as our sum which is greater than $79$ since $k\ge 2$.

Way 3

We must ignore the cases where $a_n=1$, as required by the problem statement. Write $a_n=\sqrt{400-k}$ for some integers $k,a_n$. We want to minimize $a_n+n$. Note if $a_n$ is even ($k$ is even) then $n=1.5k+2$, and if $a_n$ is odd ($k$ is odd), then $n=1.5k+1.5$. Rewrite $k=400-a_n^2$ and note that $a_n$ is at most $19$. In the case that $a_n$ is odd, we have $a_n+n=a_n+1.5(400-a_n^2)+1.5$. This is a quadratic in $a_n$ and is strictly decreasing for $a_n>0$, so to minimize we should choose $a_n=19$, which gives $a_n+n=79$. Do the case for $a_n$ even as well, you find that $79$ is the lowest.