Quote:
Originally Posted by CRGreathouse
There's a wellknown 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.

I don't know. I would write to Bob Vaughan. He would know the answer.