Let p be a prime. Consider the equation $\frac1x+\frac1y=\frac1p$. What are the solutions? Write down the set of distinct solutions and prove your list is complete.
$x$ and $y$ are positive integers.
I have rewritten it as $\frac{(x+y)}{xy} = \frac1p$, but I don't understand where to go from here?
 A: Hint: this type of diophantine equation is solvable by a generalization of completing the square. Namely, completing a square generalizes to completing a product as follows:
$$\begin{eqnarray} &&axy + bx + cy\, =\, d,\ \ a\ne 0\\
\overset{\times\,a}\iff\, &&\!\! (ax+c)(ay+b)\, =\, ad+bc\end{eqnarray}\qquad\qquad$$
Therefore we deduce: $\, xy - px - py = 0 \iff (\color{#0a0}{x-p})(y-p) = \color{#c00}{p^2}$
Therefore, by uniqueness of prime factorizations $\ \color{#0a0}{x-p}\,\in\:\!  \pm \{\color{#c00}{1,p,p^2}\}\ $ so $\ x = \,\ldots$
Remark $ $ A handy tool when learning these topics is Dario Alpern's online bivariate diophantine equation solver, which can provide a step-by-step explanation of the methods used.
A: Expanding a bit on Elaqqad comment.
$$\frac{x+y}{xy}=\frac{1}{p}\implies xy=p(x+y)\\xy-px-py=0\\x(y-p)-py=0\\x(y-p)-py+p^2=p^2\\(x-p)(y-p)=p^2$$
Now $p^2$ has only 3 divisors $1,p,p^2$ since $p$ is prime,then you either have that $x-p=p,y-p=p$ or $x-p=1,y-p=p^2$ or $x-p=p^2,y-p=1$ or equivalently $(x,y)=(2p,2p)\lor (p+1,p^2+p)\lor(p^2+p,p+1)$.
A: You have: $p(x+y) = xy \Rightarrow p \mid xy \Rightarrow p \mid x$ or $p \mid y$ since $p$ is a prime. If $p \mid x \Rightarrow x = kp$, and substitute this into the equation: $p(kp+y) = kpy \Rightarrow kp+y=ky \Rightarrow kp = (k-1)y \Rightarrow p \mid (k-1)y \Rightarrow p \mid (k-1)$ or $p \mid y$. Now if $p \mid y \Rightarrow y = np \Rightarrow kp = np(k-1) \Rightarrow k = n(k-1)$. If $n = 1 \Rightarrow k = k-1$, contradiction. Thus $n \geq 2$, and if $n = 2 \Rightarrow k = 2(k-1) \Rightarrow k = 2$. Thus $(x,y) = (2p,2p)$ is a solution. If $n > 2$ it is easy to see the equation has no natural solutions. If $p \mid (k-1) \Rightarrow k - 1 = mp \Rightarrow k = 1 + mp \Rightarrow (1+mp)p = mpy \Rightarrow 1+mp = my \Rightarrow 1 = m(y-p) \Rightarrow 1 = m = y-p \Rightarrow y = k = p+1 \Rightarrow x = kp = p(p+1) \Rightarrow (x,y) = (p^2+p, p+1)$ is another solution.And since the equation is symmetric in $y$ as well, you would obtain the same solution if $p\mid y$, and conclude that those two solutions are the ones for the equation above.
