## Re: The square of an odd prime expressed as the sum of four non zero squares

Expand Messages
• I hacked together another formula, one which does away with the floor function and instead uses the mod (%) function. f2 = ( ( n^2 + 4*n + (19 * (5 * (n % 48)
Message 1 of 10 , Sep 28, 2012
I hacked together another formula, one which does away with the floor function and instead uses the mod (%) function.

f2 = ( ( n^2 + 4*n + (19 * (5 * (n % 48) + 2 )^2 ) % 48) - 24) /48

However it doesn't work for the primes n = 3 (and 2).

If anyone knows how to clean up this obscure form, I would be interested!

Mark

--- In primenumbers@yahoogroups.com, "Mark" <mark.underwood@...> wrote:
>
> How many ways can the square of an odd prime n be expressed as the sum of four non zero squares?
>
> The answer surprisingly appears to have the formula:
>
> f = floor((n^2+4*n+24)/48.)
>
> Here's a GP Pari program which counts the number of ways that an odd prime n can be written as the sum of four non zero squares, and compares that count (k) with the formula derivation f = floor((n^2+4*n+24)/48.) .
>
>
> forprime(n=3,100, k=0; for(s1=1,sqrt((n^2)/4),for(s2=s1,sqrt((n^2 - s1^2)/3) ,for(s3=s2,sqrt((n^2-s1^2 - s2^2)/2) ,if(issquare(n^2-s1^2-s2^2-s3^2),k++)))) ; f = floor((n^2+4*n+24)/48.) ; print1([n,k,f]" "))
>
>
>
> [3, 0, 0] [5, 1, 1] [7, 2, 2] [11, 3, 3] [13, 5, 5] [17, 7, 7] [19, 9, 9] [23, 13, 13] [29, 20, 20] [31, 23, 23] [37, 32, 32] [41, 38, 38] [43, 42, 42] [47, 50, 50] [53, 63, 63] [59, 77, 77] [61, 83, 83] [67, 99, 99] [71, 111, 111] [73, 117, 117] [79, 137, 137] [83, 150, 150] [89, 172, 172] [97, 204, 204]
>
>
> Does it always hold? I'm not sure as I have no proof.
>
>
> Early last week I submitted the sequence 0,1,2,3,5,7,9,13,20... to OEIS (but have not heard back).
>
>
> Mark
>
Your message has been successfully submitted and would be delivered to recipients shortly.