Browse Groups

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

(10)
• NextPrevious
• 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 =
Message 1 of 10 , Sep 10, 2012
View Source
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
• How do you write 5 as sum of four nonzero squares ? Maximilian PS: if you haven t heard back from OEIS, the messages may have been sent to trash by your spam
Message 1 of 10 , Sep 10, 2012
View Source
How do you write 5 as sum of four nonzero squares ?

Maximilian
PS: if you haven't heard back from OEIS, the messages may have been sent to
trash by your spam filter. There have been requests from the editors, cf.
https://oeis.org/draft/A216374

On Mon, Sep 10, 2012 at 11:33 AM, 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]
>
>

[Non-text portions of this message have been removed]
• I m sorry, I did not read the definition correctly, I missed the square of the odd prime. I checked and found it indeed surprising that neither of the
Message 1 of 10 , Sep 10, 2012
View Source
I'm sorry, I did not read the definition correctly, I missed "the
square of" the odd prime.

I checked and found it indeed surprising that neither of the sequences
"Number of ways to write n [resp. n^2] as sum of four nonzero squares"
is not in OEIS.
I used part of your code:
{a(n)=sum(s1=1,sqrt(n^2/4),sum(s2=s1,sqrt((n^2 - s1^2)/3)
,sum(s3=s2,sqrt((n^2-s1^2 - s2^2)/2),issquare(n^2-s1^2-s2^2-s3^2))))}
and got:
0,0,1,2,1,19,10,63,1,204,62,341,10,659,198,1983,1,...

Maximilian

On Mon, Sep 10, 2012 at 5:48 PM, Maximilian Hasler
<maximilian.hasler@...> wrote:
> How do you write 5 as sum of four nonzero squares ?
>
> Maximilian
> PS: if you haven't heard back from OEIS, the messages may have been sent to
> trash by your spam filter. There have been requests from the editors, cf.
> https://oeis.org/draft/A216374
>
>
> On Mon, Sep 10, 2012 at 11:33 AM, 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]
>>
>
• I just looked, and yes indeed it went to a spam folder. But it was sent just today, five hours ago. I looks like I will have to do some editting to make it
Message 1 of 10 , Sep 10, 2012
View Source
I just looked, and yes indeed it went to a spam folder. But it was sent just today, five hours ago. I looks like I will have to do some editting to make it passable.

I put something to the effect that "It is yet to be seen" if the result or a proof is known. An editor did not like that. Also another editor did not like a link.

Maximilian your code is a little different than mine so that must be making a difference.

Mark

--- In primenumbers@yahoogroups.com, Maximilian Hasler <maximilian.hasler@...> wrote:
>
> I'm sorry, I did not read the definition correctly, I missed "the
> square of" the odd prime.
>
> I checked and found it indeed surprising that neither of the sequences
> "Number of ways to write n [resp. n^2] as sum of four nonzero squares"
> is not in OEIS.
> I used part of your code:
> {a(n)=sum(s1=1,sqrt(n^2/4),sum(s2=s1,sqrt((n^2 - s1^2)/3)
> ,sum(s3=s2,sqrt((n^2-s1^2 - s2^2)/2),issquare(n^2-s1^2-s2^2-s3^2))))}
> and got:
> 0,0,1,2,1,19,10,63,1,204,62,341,10,659,198,1983,1,...
>
> Maximilian
>
>
> On Mon, Sep 10, 2012 at 5:48 PM, Maximilian Hasler
> <maximilian.hasler@...> wrote:
> > How do you write 5 as sum of four nonzero squares ?
> >
> > Maximilian
> > PS: if you haven't heard back from OEIS, the messages may have been sent to
> > trash by your spam filter. There have been requests from the editors, cf.
> > https://oeis.org/draft/A216374
> >
> >
> > On Mon, Sep 10, 2012 at 11:33 AM, 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]
> >>
> >
>
• ... Here is the generating function for Mark s interesting claim: g(x)=x^4/((1-x)*(1-x^3)*(1-x^8)); f(n)=floor((n^2+4*n+24)/48);
Message 1 of 10 , Sep 10, 2012
View Source
"Mark" <mark.underwood@...> wrote:

> "It is yet to be seen" if the result or a proof is known.

Here is the generating function for Mark's interesting claim:

g(x)=x^4/((1-x)*(1-x^3)*(1-x^8));

f(n)=floor((n^2+4*n+24)/48);
print(sum(n=0,100,f(n)*x^n)+O(x^101)-g(x));

O(x^101)

David
• ... Thank you David. A friend told me that your code demonstrates that your g(x) function appears to have my sequence as coefficients. I must confess I am
Message 1 of 10 , Sep 11, 2012
View Source
>
>
>
> "Mark" <mark.underwood@> wrote:
>
> > "It is yet to be seen" if the result or a proof is known.
>
> Here is the generating function for Mark's interesting claim:
>
> g(x)=x^4/((1-x)*(1-x^3)*(1-x^8));
>
> f(n)=floor((n^2+4*n+24)/48);
> print(sum(n=0,100,f(n)*x^n)+O(x^101)-g(x));
>
> O(x^101)
>
> David
>
Thank you David. A friend told me that your code demonstrates that your g(x) function appears to have my sequence as coefficients. I must confess I am totally ignorant of this aspect of number theory and how you managed to find that g(x) function. My blind spot in this regard is thwarting me in understanding the implications of the form of your g(x) function, and whether it implies that the f(n) function will continue to give the correct values for higher n.

struggling, but amazed as usual at your contributions,
Mark
• Actually David gave simply the g.f. (generating function) of the sequence f(n)=floor((n^2+4*n+24)/48) In some sense there is no higher number theory involved
Message 1 of 10 , Sep 11, 2012
View Source
Actually David gave simply the g.f. (generating function) of the sequence

f(n)=floor((n^2+4*n+24)/48)

In some sense there is no "higher" number theory involved in this
(at least it does not at all refer to primes).

AFAICS David did not explain why

f(prime(n)) = A025428(prime(n)^2)

(which is Mark's A216374).

Maximilian
• ... Indeed. It seemed to me that g(x) = x^4/((1-x)*(1-x^3)*(1-x^8)) = suminf(n=0,f(n)*x^n) made Mark s conjecture ... look neater. I made no attempt to prove
Message 1 of 10 , Sep 12, 2012
View Source
--- In primenumbers@yahoogroups.com, Maximilian Hasler <maximilian.hasler@...> wrote:

> Actually David gave simply the g.f. (generating function) of the sequence
> f(n)=floor((n^2+4*n+24)/48)

Indeed. It seemed to me that

g(x) = x^4/((1-x)*(1-x^3)*(1-x^8)) = suminf(n=0,f(n)*x^n)

> f(prime(n)) = A025428(prime(n)^2)

look neater. I made no attempt to prove the conjecture.

David
• There is a formula for r_4(n), when you allow zeros and distinguish signs and order, see http://mathworld.wolfram.com/SumofSquaresFunction.html
Message 1 of 10 , Sep 12, 2012
View Source
There is a formula for r_4(n), when you allow zeros and distinguish signs
and order, see http://mathworld.wolfram.com/SumofSquaresFunction.html

r_4(n)=8*sumdiv(n,d,d*(d%4>0)), and this is for n=p^2 (when p>2 prime) is
r_4(p^2)=8*(p^2+p+1).

Essentially you count every 2^4*4! of these terms (the possibility of zero
and two equal terms is small), this gives r_4(p^2)/16/24~p^2/48+O(p), so
your conjecture is in the right order of magnitude.

[Non-text portions of this message have been removed]
• 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
View Source
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.
• Changes have not been saved
Press OK to abandon changes or Cancel to continue editing
• Your browser is not supported
Kindly note that Groups does not support 7.0 or earlier versions of Internet Explorer. We recommend upgrading to the latest Internet Explorer, Google Chrome, or Firefox. If you are using IE 9 or later, make sure you turn off Compatibility View.