<s>[INST] If $\frac{x^2+y^2+x+y-1}{xy-1}$ is an integer for positive integers $x$ and $y$, then its value is $7$. I saw this on quora
and haven't been able to solve it.
If $\dfrac{x^2+y^2+x+y-1}{xy-1}$
is an integer for positive integers
$x$ and $y$,
then its value is $7$.
If
$y=1$ this is
$\dfrac{x^2+x+1}{x-1}
= x+2+\dfrac{3}{x-1}$
which is an integer only when
$x=2$ or $x=4$ and has value $7$.
Looking at the values from 2 to 20
for $x$ and $y$,
this is an integer only for
$x=2, y=12$ (and $x=12, y=2$).
This value is 7.
So it looks like this might be correct,
and I don't know how to show it.
 [/INST] If $f(x,y)=\dfrac{x^2+y^2+x+y-1}{xy-1}$ when integer must be equal to $7$ then
$$g(x,y)=\frac{x^2+y^2+x+y-6xy+5}{xy-1}$$ must be equal to $1$ because $f(x,y)=6+g(x,y)$ so we can solve the equation
$$x^2+y^2+x+y-7xy+6=0$$ which admits several infinite sets of solutions $(x,y)$ like to them of Pell-Fermat equations (look at Wolfram about this). One of these sets is given by
$$15x=(6+\sqrt5)(161-72\sqrt5)^n+(6-\sqrt5)(161+72\sqrt5)^n+3\\  \\30y=(57+25\sqrt5)(161-72\sqrt5)^n+(57-25\sqrt5)(161+72\sqrt5)^n+6$$ For example for $n=2$ we get the solution $(x,y)=(26017,3796)$ which certainly satisfies $f(x,y)=7$ as well as all the other ones.
</s>