Thread: Sums of three squares View Single Post
 2009-11-05, 07:01 #1 CRGreathouse     Aug 2006 32·5·7·19 Posts Sums of three squares There's a well-known formula for the number of ways that a number can be expressed as the sum of two squares: the product of one more than the exponents of the primes = 1 mod 4, assuming that all primes = 3 mod 4 appear to an even power (and 0 if any appear to an odd power). Is there a similarly nice formula for sums of three squares? I was trying to do some calculations with them but the inefficiency of my current program makes that difficult. I'm able to use some properties of such numbers (removing factors of 4, checking mod 8, using an efficient sum of two primes subroutine to remove some cases) but it's still slow -- getting to ten million will take all night, where with sums of two primes that would take 25 seconds.