2007 iTest Problems/Problem 47

Problem

Let $\{X_n\}$ and $\{Y_n\}$ be sequences defined as follows: $X_0=Y_0=X_1=Y_1=1$,

\begin{align*}X_{n+1}&=X_n+2X_{n-1}\qquad(n=1,2,3\ldots),\\ Y_{n+1}&=3Y_n+4Y_{n-1}\qquad(n=1,2,3\ldots).\end{align*}

Let $k$ be the largest integer that satisfies all of the following conditions: $|X_i-k|\leq 2007$, for some positive integer $i$; $|Y_j-k|\leq 2007$, for some positive integer $j$; and $k<10^{2007}$. Find the remainder when $k$ is divided by $2007$.

Solution

First, we solve these linear recurrences. The characteristic polynomial of $X_n$ is $x^2=x+2$ which has roots -1 and 2. Then with the given values, $X_n=\lambda_1(-1)^n+\lambda_2(2)^n$ where $\lambda_1$ and $\lambda_2$ are the solutions to the system $$\begin{cases} 1=\lambda_1+\lambda_2\\ 1=-\lambda_1+2\lambda_2 \end{cases}$$ Solving, we find $\lambda_1=1/3$ and $\lambda_2=2/3$, so $X_n=\frac{(-1)^n+2^{n+1}}{3}$. Similarly, $Y_n=\frac{3(-1)^n+2^{2n+1}}{5}$.

We can ignore the $(-1)^n$ terms because they will be inconsequential compared to the $2^n$ terms, so define $x_n=\frac{2^{n+1}}{3}$ and $y_n=\frac{2^{2n+1}}{5}$. Note that for some $a$ and $b$, $|X_a-Y_b|\le4014$ so that we can place $k$ at the average of $X_a$ and $Y_b$ at least. Therefore $X_a$ and $Y_b$ will have to be somewhat close to each other, so we examine the equation $X_a\approx x_a=Y_b\approx y_b$, or $\frac{2^a}{3}=\frac{2^{2b}}{5}$. Solving for $a$ results in $a=2b-\log_2(5/3)$, and because $a$ and $b$ are integers, $a=2b-1$.

Using our approximations in our inequality, we find $|\frac{2^{2b}}{3}-\frac{2^{2b+1}}{5}|\le4014$, which simplifies to $2^{2b}\le4014\cdot15$. Bashing or calculator use results in $b<8$, so $b=7$ and $a=13$. Note that $X_{13}, so the largest $k$ possible will be $X_{13}+2007=7468$. The requested answer is $7468\text{ mod }{2007}=\boxed{1447}$.

~clarkculus