# Can it be proven that iff $N$ is prime, then there are exactly 6 integer solutions to $xy = N(x+y)$?

So my alarm clock makes me do some simple math problems to turn it off. This morning I confused $$6 + 3$$ for $$6 \cdot 3$$ but $$18 = 2 \cdot 9$$ which was slightly amusing to me. Solving $$xy=N(x+y)$$ for other $$N$$ (only the integer solutions of $$x$$ and $$y$$) using Wolfram Alpha gave an interesting pattern: whenever $$N$$ is a prime number, there are exactly $$6$$ unique integer solutions. When $$N$$ is not prime, the number of solutions is not exactly $$6$$.

Can this be proven?

• $N$ is usually reserved for $N=PQ$ where both $P$ and $Q$ are prime so it would be much better to post your question as: $xy = P(x+y)$. Just saying. Feb 5 at 13:44

$$xy=p(x+y)\Rightarrow xy-px-py+p^{2}=p^{2}\Rightarrow (x-p)(y-p)=p^{2}$$ We can split up $$p^{2}$$ into 2 factors in exactly 6 different ways ($$p\cdot p$$, $$-p\cdot -p$$, $$1\cdot p^{2}$$, $$-1\cdot -p^{2}$$, $$p^{2}\cdot 1$$, $$-p^{2}\cdot-1$$), giving rise to the 6 solution pairs.
Alternately, $$xy = N(x+y)$$ can be solved for $$y$$ to give $$y = Nx/(x-N)$$. If you then do the polynomial division you can write
$$y = N + {N^2 \over x-N}$$
and so as $$x$$ ranges over the integers, you get integer $$y$$ exactly when $$x - N$$ is a factor of $$N^2$$. So the number of solutions is just the number of factors of $$N^2$$, positive or negative.
If $$N$$ is prime then $$N^2$$ has three positive factors, namely $$1, N, N^2$$, and thus six total. But if $$N$$ is not prime then $$N^2$$ will have more than three positive factors and thus you'll have more than six solutions.