Given that the integers $m$ and $n$ in the set $A=\left\{1,2,3,....,2024\right\}$ satisfy $(m^2-mn-n^2)^2=1$. Find the maximum possible value of $m^2+n^2$.
My effort: We have $m^2-mn-n^2=\pm 1$
Case $1.$ If $m^2-mn-n^2=1 \Rightarrow m^2-mn-(n^2+1)=0$
Now the Discriminant is $$D=n^2+4(n^2+1)=k^2, k \in \mathbb{Z}$$
$$ \implies 5n^2+4=k^2$$ I am not able to proceed now.Same problem with Case $2.$
If $(m^2-mn-n^2)^2=1$ then $$(2m-n)^2-5n^2=4m^2-4mn-4n^2=\pm4,$$ which is a (pair of) Pell equations. For $(m,n)=(1,0)$ and $(m,n)=(0,1)$ we have $$(2\cdot1-0)^2-5\cdot0^2=4\qquad\text{ and }\qquad (2\cdot1-1)^2-5\cdot(-1)^2=-4,$$ and the fundamental solution is $2+\sqrt{5}$. A few quick computations show that \begin{eqnarray} 2\cdot(2+\sqrt{5})^5\ \ &=&\ \ 1364+\ \ 610\sqrt{5},\\ 2\cdot(2+\sqrt{5})^6\ \ &=&\ \ 5778+2584\sqrt{5},\\ (1+\sqrt{5})\cdot(2+\sqrt{5})^5\ \ &=&\ \ 2207+\ \ 987\sqrt{5},\\ (1+\sqrt{5})\cdot(2+\sqrt{5})^6\ \ &=&\ \ 9349+4181\sqrt{5},\\ (1+\sqrt{5})\cdot(2+\sqrt{5})^{-5}&=&\ \ \ \ 843-\ \ 377\sqrt{5},\\ (1+\sqrt{5})\cdot(2+\sqrt{5})^{-6}&=&-3571-1597\sqrt{5},\\ \end{eqnarray} and so the maximum is at $(m,n)=(1597,987)$.