First time here? Check out the FAQ!
answered 1 year ago
Here is a possible approach:
def all_two_squares(n): return [(abs(d[0]),abs(d[1])) for d in divisors(GaussianIntegers()(n)) if norm(d)==n]