<s>[INST] Let $x$ and $y$ be positive integers such that $xy \mid x^2+y^2+1$. Let $x$ and $y$ be positive integers such that $xy \mid  x^2+y^2+1$.
Show that $$ \frac{x^2+y^2+1}{xy}= 3 \;.$$
I have been solving this for a week and I do not know how to prove the statement. I saw this in a book and I am greatly challenged. Can anyone give me a hint on how to attack the problem? thanks
 [/INST] $x$ divides $x^2 + y^2 + 1$ implies $y^2 = ax - 1$.
Then $y$ divides $x(x+a)$
Case 1 - $y$ divides $x$, so $x = by$.
$$1/b + b + 1/(by^2) = k$$.
$$b=x=y=1$$
$$k=3$$
Or, $b=x=2$, $y=1$, $k=3$
Case 2 - $y$ divides $x+a$, so $y = -a \text{ mod } x$, $y^2 = 1 \text{ mod } x$.
$$x^2 + y^2 +1  = 2 \text{ mod } x$$
$x$ is $1$ or $2$.  (Otherwise, $x$ does not divide the equation)
If $x = 1$,  $x^2 + y^2 +1  = 2 \text{ mod } y$,   $y$ is $1$ or $2$
If $x = 2$,  $y$ is $1$ or $5$.
Solutions: $(1,1),(2,1),(5,2)$, $k$ is always $3$
(Tough to type on the phone)
</s>