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$$
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$$
On
Note: For symmetry, it is best to do the minor change of variables $n=m+2$.
When dealing with integer solutions to quadratic forms, there may be a Pell equation lurking nearby. For any integer $m>2$, the equation,
$$xy-\frac{(x+y)^2}{m+2}=m-2$$
has an infinite number of positive integer solutions. Define $D = m^2-4$, then
$$x = (m^2-2)(p^2+Dq^2)-2Dmpq\tag1$$
and the variable $y$ as either,
$$y_1 = m(p^2+Dq^2)-2Dpq\tag{2a}$$
or,
$$y_2 =m(m^2-3)(p^2+Dq^2)-2D(m^2-1)pq\tag{2b}$$
where $p,q$ solve the Pell equation,
$$p^2-Dq^2=k,\;\;\text{where}\; k = 1\;\text{or}\; 4\tag3$$
The case $k=1$ is routine to solve. If we choose $k=4$, then $(3)$ has an infinite family of parametric solutions. For example: $p,q = m^2-2,\; m$ yields (after letting $m=n-2$),
$$x,\, y_1,\, y_2 = n^2-4n+2,\;(n^2-4n+1)(n-2),\;n-2$$
which is the first parameterization found by MacLeod in his answer while the next $p,q = m^3-3m,\; m^2-1$ gives,
$$x = n^4-8n^3+20n^2-16n+2$$
which is his second. Since $p^2-(m^2-4)q^2 = 4$ has an infinite number of parameterizations, then so does $x,y$ as MacLeod has suggested.
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.