Efficient Computation of Integer Representation as a Sum of Three Squares

computational-number-theorynt.number-theorysums-of-squares

Recently I've been studying the problem of integer representation as sum of three squares. Most of the articles that I've found study the function $r_m(n)$ which counts the number of representations of $n$ as the sum of $m$ squares. However, this is not what I am interested in. What I'm looking for is an efficient way (for some given $n$) to find $x$, $y$ and $z$ such that $n = x^2 + y^2 + z^2$. I need to find at least one such representation. Can you recommend me some articles that study this problem?

P.S. I believe that Emil Grosswald's book "Representation of integers as Sums of Squares" contains the answer. However, I could not find this book on my university's web-site.

Best Answer

This problem is discussed in my paper with Rabin, Randomized algorithms in number theory, Commun. Pure Appl. Math. 39, 1985, S239 - S256. We give an algorithm that, assuming a couple of reasonable conjectures, will produce a representation as a sum of three squares in polynomial time.