# Find all pair of $(x,y)$ such that $\frac{x^2+y^2}{x-y}$ is an integer and divides 1995.

Find all pair of positive integers $(x,y)$ such that $\frac{x^2+y^2}{x-y}$ is an integer and divides 1995.

My Work
I think we should start from factorizing $1995 = 3\times 5\times 7\times 19$.
I tried finding some $(x,y)$ which satisfies and then proceed. As when this type of problems appear in Olympiads, most of the time there are only a few solutions. But, I found that $(2,1), (3,1), (21,7), \cdots$ and many many satisfies this. So, I think the answer is a set with some conditions.
I cant find how to start. Any hint will be helpful.

First, we will prove a lemma.

Lemma Let $p$ be a prime number satisfying $p \equiv 3 (mod \ 4)$. Then, $$p\mid a^2+b^2 \implies p\mid a \ \text{and} \ p\mid b.$$

Proof of Lemma First, note that if $p\mid a$, then $p$ must divide $b$ and vice versa. So, assume $p\nmid a,b$. Now, $$\frac{a^2}{b^2}\equiv -1 (mod p)$$ gives us a contradiction, since $-1$ is not a quadratic residue modulo $p$, if $p-3$ is divisible by $4$ (well-known fact from number theory).

Equipped with this, we will attack the problem. Suppose, $$\frac{x^2+y^2}{x-y} = p\alpha$$ for some $\alpha$ and $p \equiv 3 \ (mod \ 4)$. Then, we can define $x = px'$ and $y = py'$ to argue that $$\frac{x'^2+y'^2}{x'-y'} = \alpha.$$

With this reasoning, starting from any $p\alpha$, we can arrive at either $\alpha = 1$ or $5$, which is the only prime divisor of $1995$, that is congruent to $1$ modulo $4$.

Case 1 $\frac{x'^2 + y'^2}{x'-y'}=1$. With some very basic inequalities, you can convince yourself that this is not possible.

Case 2 $\frac{x'^2 + y'^2}{x'-y'}=5$. In this case, note that $$x'^2 \leq x'^2 + y'^2 = 5x'-5y' \leq 5x' \implies x'\leq 5.$$

With some algebra, the only solutions are $(x',y') = (3,1)$ and $(2,1)$. Now from here, you can get the entire solution set. For instance, to make $\frac{x^2+y^2}{x-y}=5$, the pairs above work. To make it, say, $3\times 5 \times 7$, multiply these pairs by $3\times 7$. This produces the entire set, and note that you have $16$ possibilities, as $1995$ has 16 divisors.