<s>[INST] Solve this equation $xy-\frac{(x+y)^2}{n}=n-4$ Let $n>4$ be a given positive integer. Find all pairs of positive integers $(x,y)$ such that
$$xy-\dfrac{(x+y)^2}{n}=n-4$$
What I tried is to use
$$nxy-(x+y)^2=n^2-4n\Longrightarrow (n-2)^2+(x+y)^2=nxy+4$$
 [/INST] If you frame the problem as a quadratic equation in $y$, the condition that $y$ is an integer implies that
\begin{equation*}
n(n-4)(x^2-4)=\Box
\end{equation*}
By parameterising this quadric and searching for integer pairs, we get what looks like an infinite number of pairs $(x,y)$ for each $n$.
Investigating these we find $2$ simple parametric solutions
\begin{equation*}
x=n^2-4n+2 \hspace{2cm} y=n-2 \hspace{1cm} \mbox{or} \hspace{1cm} y=(n-2)(n^2-4n+1)
\end{equation*}
and
\begin{equation*}
x=n^4-8n^3+20n^2-16n+2 \hspace{1cm} y=(n-2)(n^2-4n+1) \hspace{0.5cm} \mbox{or} \hspace{0.5cm} y=(n-2)(n^4-8n^3+19n^2-12n+1)
\end{equation*}
There are almost certainly an infinite number of such parametric solutions.
</s>