Problem: Find all integers $m > 1$ for which the sequence $(a_n)_{n\ge1}$
defined recursively by
\[ a_{n+2} = m(a_{n+1} + a_n) - a_{n-1} \]
with initial conditions $a_1 = a_2 = 1$ and $a_3 = 4$
contains only perfect squares.

\end{enumerate}

Solution: The answer is $m=2$ and $m=10$.
The verification they work is left as an exercise.
Now compute the first several terms:
\begin{align*}
  a_1 &= 1 \\
  a_2 &= 1 \\
  a_3 &= 4 \\
  a_4 &= 5m-1 \\
  a_5 &= 5m^2+3m-1 \\
  a_6 &= 5m^3+8m^2-2m-4.
\end{align*}

We will now prove:
\begin{claim*}
  If $a_4 \cdot a_6$ is a square then $m \in \{2,10\}$.
\end{claim*}
\begin{proof}
  A computation gives
  \begin{align*}
    16 a_4 a_6
    &= 400 m^4 + 560 m^3 - 288 m^2 - 288 m + 64 \\
    &= \left(20m^2+14m-\frac{121}{10} \right)^2
      + \frac{508}{10}m - \frac{8241}{100}.
  \end{align*}
  Let $A = 200m^2+140m-121 \equiv -1 \pmod{20}$.
  Then $42A+441 > 5080m-8241$ for all $m$ and hence
  \[ A^2 < \underbrace{A^2+5080m-8241}_{=1600a_3a_5} < (A+21)^2. \]
  But the inner term is the square of a multiple of $20$
  so it must equal $(A+1)^2$.
  Thus, we have
  \[ 2(\underbrace{200m^2+140m-121}_{=A})+1 = 5080m-8241 \implies m \in \{2,10\} \]
  as desired.
\end{proof}

\begin{remark*}
  In general, if $f(x) \in \ZZ[x]$ has even degree
  and the leading coefficient is a square,
  then $f(x)$ should be a square finitely often
  (unless $f$ is itself the square of a polynomial).
  The proof proceeds along the same lines,
  by bounding $f$ between two squares.
  See China TST 2001 for example
  which asked students to determine all $x$ for which
  \[ f(x) = x^6 + 15x^5 + 85x^4 + 225x^3 + 274x^2 + 120x + 1 \]
  was equal to a perfect square.
\end{remark*}