Tags: cryptography-rsa
Rating:
You can calculate (p+q)^2, (p-q)^2
because (p+q)^2 = p^2+q^2+2pq = p^2+q^2+2n
and (p-q)^2 = p^2+q^2-2pq = p^2+q^2-2n.
Once you know the two values above, you can easily calculate p, q.
Please check the code for detailed implementation.