View Single Post
Old 2009-11-05, 12:47   #2
R.D. Silverman
R.D. Silverman's Avatar
Nov 2003

22×5×373 Posts

Originally Posted by CRGreathouse View Post
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.
I don't know. I would write to Bob Vaughan. He would know the answer.

Last fiddled with by R.D. Silverman on 2009-11-05 at 12:52 Reason: typo
R.D. Silverman is offline   Reply With Quote