Let p and q be distinct odd primes. Define $n=pq$ and$ \phi(n)=(p−1)(q−1)$ (a) Show that 
$p+q = n−\phi(n)+1$ and $p−q = \sqrt{(p+q)^2−4n}$. 
￼(b) Suppose you are given that $n = 675683$ and are told that $p−q = 2$. Explain how this information can help us factor $n$ quickly. 
(Hint: Try to use the result from part (a) to obtain the values of $p$ and $q$ instead. You may use a calculator to help you solve this problem.)
(c) Suppose $n$ and $\phi(n)$ are known, but $p$ and $q$ are unknown primes. Use your answer from part (a) to express the primes $p$ and $q$ in terms of $n$ and $\phi(n)$
I'm just having a bit of trouble with part (c). I think I figured out part (a) and (b) but just in case here's my work.
Part(a) 
$\phi(n) = (p-1)(q-1) = pq -(p+q) + 1 = n -(p+q) + 1$ 
So 
$p+q = n - \phi(n) + 1$
$(p-q)^2 = p^2 + q^2 -2n$ 
$(p+q)^2 = p^2 + q^2 + 2n$ 
$(p+q)^2 -(p-q)^2 = 4n $
So 
$(p+q)^2 -4n = (p-q)^2$ 
$p-q = \sqrt{(p+q)^2 -4n}$
(b) $n = pq = 675683$ and $p-q = 2$ 
So $p(p-2) = 675683 $
$p^2-2p - 675683 = 0$. 
Solving by the quadratic formula 
$p = 1 + \sqrt{675684} = 823$ 
$q = p-2 = 821. $

Since you already have expressions for p+q and p-q in terms of just n and phi(n), all you have to do is use these expressions and note that p can be expressed as
p=((p+q)+(p-q))/2
and likewise
q=((p+q)-(p-q))/2
