Editor's corner: the Euclidean algorithm strikes again

On page 144 of this issue of the MONTHLY Don Zagier presents an extremely short, elegant, and elementary proof of the classic result that any prime p congruent to 1 (mod 4) is a sum of two squares. The problem of finding a representation of p as a2 + /32 often arises in computational number theory; for example, it is a key step in factoring Gaussian integers into prime Gaussian integers. Fortunately, this problem can be solved by a very fast and easy-to-program algorithm-it is not widely known, although it uses nothing beyond undergraduate mathematics. In this note we will present the algorithm and a proof of its correctness. We pause for a moment to point out a beautiful formula for a and ,B due to