GaussianFactorizationPackage

gaussfac.spad line 1 [edit on github]

Package for the factorization of complex or gaussian integers.

factor : Complex(Integer) -> Factored(Complex(Integer))

factor(zi) produces the complete factorization of the complex integer zi.

prime? : Complex(Integer) -> Boolean

prime?(zi) tests if the complex integer zi is prime.

sumSquares : Integer -> List(Integer)

sumSquares(p) construct a and b such that a^2+b^2 is equal to the integer prime p, and otherwise returns an error. It will succeed if the prime number p is 2 or congruent to 1 mod 4.