Verification of solution of contest problem related to algebra

algebra-precalculusnumber theorysystems of equations

Given that $m, n$ are positive integers such that $mn<2023$ and $|n^2-mn-m^2|=1$, find the maximum value of $mn$.

This was problem 3 on the preliminary IMO exam where I live. My answer was $6$. However, there is space for $4$ numbers on the answer sheet, indicating that I might have got it wrong. Please help me find where I made a mistake (or if I even made one). I'd appreciate correction as well.

Below is my solution:
\begin{align*}
|n^2-mn-m^2|=1 &\Longrightarrow n^2-mn-m^2=\pm 1\\
&\Longrightarrow 1 = n^2-mn-m^2 \quad \textbf{or} \quad m^2+mn-n^2\\
&\Longrightarrow \text{WLOG, }\quad n^2 \pm mn – m^2 = 1
\end{align*}

Where $m>n>0$.
$$\pm mn = 1+m^2-n^2$$
Because we want the maximum value of $mn$, we'll take the positive value, that is, we seek to find the maximum $mn$ that satisfies
\begin{align*}
&mn = 1+m^2-n^2\\
&\Longrightarrow n^2+mn-(m^2+1) = 0\\
&\Longrightarrow n = \frac{-m\pm \sqrt{5m^2+4}}{2}
\end{align*}

Because $n$ is natural, the determinant $D = 5m^2+4$ is a perfect square, let $$5m^2+4 = k^2$$, where $k$ is natural.
Notice
$$5m^2 = k^2-2^2 = (k+2)(k-2)$$
Consider the "gap" between two squares. For example, $2^2-1^2=3$, $3^2-2^2=5$ and so on. It is trivial that no two squares have the difference of $4$, that is, the criteria $$m^2 = k^2-4$$ cannot be satisfied. So it must be that $5$ divides (or, equals), $(k+2) \quad \textbf{or} \quad (k-2)$. From there we have two values of $k$.
\begin{align*}
k = 3 \quad &\textbf{or} \quad 7\\
m = 1 \quad &\textbf{or} \quad 3\\
n = 1 \quad &\textbf{or} \quad 2
\end{align*}

The two sets of possible $(k, m, n)$ are listed respectively.
Therefore, there are only two values of $mn$, $6$ and $1$. We choose the larger. Hence, our answer is $6$.

Best Answer

If anything, here's a counter-example and its derivation: $$|21^2-21\cdot 13-13^2|=1$$ $$21\cdot 13=273\gt 6\quad$$

derivation: one of the pell equations in $\quad |m^2-mn-n^2|=1\quad$is: $$(m+2n)^2-5m^2=4,\quad subs\quad N=m+2n,\quad\text{consider}\quad N^2-5m^2=1\quad (9-4\sqrt5)(9+4\sqrt 5)=1\implies (9N+20m)^2-5(4N+9m)^2=1\\ N_2=m_2+2n_2=9N_1+20m_1=29m_1+18n_1,\quad m_2=4N_1+9m_1=13m_1+8n_1$$ $2n_2=29m_1+18n_1-(13m_1+8n_1)=16m_1+10n_1\to\quad $ $$m_2=13m_1+8n_1, \quad n_2=8m_1+5n_1$$ $$\begin{bmatrix}m\\n\end{bmatrix}_{k+1}=\begin{bmatrix}13&8\\8&5\end{bmatrix}\cdot \begin{bmatrix}m\\n\end{bmatrix}_k,\qquad \begin{bmatrix}1\\1\end{bmatrix}\to\begin{bmatrix}21\\13\end{bmatrix}\to\cdots$$

Related Question