First time here? Check out the FAQ!
answered 2024-03-25 15:01:20 +0200
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]