2

Given a prime $p$ (with residual 1 modulo 4) what is the most efficient algorithm for computing its Gaussian prime factors, assuming $p$ could be large (i.e. perhaps more than 100 bits). Equivalently, is there a fast algorithm for finding the pair of positive integers $(a,b)$ for which $a^2 + b^2 = p$ that is significantly faster than trial and error?

1 Answers1

2

After a little research I believe I have discovered the solution to this problem myself. The key is to solve $t^2\equiv -1\pmod{p}$, which can be efficiently solved using Tonelli-Shanks (among other algorithms). Then $a+bi = \gcd(t+i,p)$, which is easily solved using Euclid's algorithm.

see related question