[go: up one dir, main page]

login
Number of solutions to n^2 = a^2 + b^2 + c^2 with positive a, b, c.
4

%I #18 Aug 02 2019 18:53:47

%S 0,0,0,3,0,0,3,6,0,12,0,9,3,6,6,15,0,9,12,15,0,33,9,18,3,12,6,39,6,18,

%T 15,24,0,48,9,30,12,24,15,45,0,27,33,33,9,60,18,36,3,48,12,60,6,36,39,

%U 45,6,78,18,45,15,42,24,114,0,36,48,51,9,93,30,54,12,51,24,87,15,87,45,60,0,120,27,63,33,51,33,105,9,63,60,84,18,123,36,75,3,69,48,165,12

%N Number of solutions to n^2 = a^2 + b^2 + c^2 with positive a, b, c.

%C Note that a(n)=0 for n=0 and the n in A094958.

%H Robert Israel, <a href="/A181787/b181787.txt">Table of n, a(n) for n = 0..2000</a>

%F a(n) = A063691(n^2). - _Michel Marcus_, Apr 25 2015

%F a(2*n) = a(n). - _Robert Israel_, Aug 02 2019

%e a(3)=3 because 3^2 = 1^2+2^2+2^2 = 2^2+1^2+2^2 = 2^2+2^2+1^2. - _Robert Israel_, Aug 02 2019

%p N:= 200: # for a(0)..a(N)

%p A:= Array(0..N):

%p mults:= [1,3,6]:

%p for a from 1 while 3*a^2 <= N^2 do

%p if a::odd then b0:= a+1; db:= 2 else b0:= a; db:= 1 fi;

%p for b from b0 by db while a^2 + 2*b^2 <= N^2 do

%p if (a+b)::odd then c0:= b + (b mod 2); dc:= 2 else c0:= b; dc:= 1 fi;

%p for c from c0 by dc do

%p v:= a^2 + b^2 + c^2;

%p if v > N^2 then break fi;

%p if issqr(v) then

%p w:= sqrt(v);

%p A[w]:= A[w]+ mults[nops({a,b,c})];

%p fi

%p od od od:

%p convert(A,list); # _Robert Israel_, Aug 02 2019

%t nn=100; t=Table[0,{nn}]; Do[n=Sqrt[a^2+b^2+c^2]; If[n<=nn && IntegerQ[n], t[[n]]++], {a,nn}, {b,nn}, {c,nn}]; Prepend[t,0]

%Y Cf. A016725, A016727, A181786, A181788.

%K nonn,look

%O 0,4

%A _T. D. Noe_, Nov 12 2010