Quote:
Originally Posted by goldbug
2n minus each prime equals the other prime to a power.

let p1 be p, let p2 be q there are 4 main cases at play (assuming p,q aren't 2):
q is 3 mod 4, is raised to an odd power, and n is odd, leading to p is 3 mod 4
q is 3 mod 4, is raised to an odd power, and n is even, leading to p is 1 mod 4
q is raised to an even power, and n is odd, leading to p is 1 mod 4
q is raised to an even power, and n is even, leading to p is 3 mod 4
now just put it into practice in code.