Coding challenge

Write some code to find the maximal value of $m^2+n^2$ if $m$ and $n$ are integers between 1 and 1981 that satisfy $(n^2-mn-m^2)^2=1$. (From Andreescu, p. 63.)

Type your code here:


Lua reference

See your results here: