cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

This page as a plain text file.
%I A181787 #18 Aug 02 2019 18:53:47
%S A181787 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 A181787 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 A181787 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 A181787 Number of solutions to n^2 = a^2 + b^2 + c^2 with positive a, b, c.
%C A181787 Note that a(n)=0 for n=0 and the n in A094958.
%H A181787 Robert Israel, <a href="/A181787/b181787.txt">Table of n, a(n) for n = 0..2000</a>
%F A181787 a(n) = A063691(n^2). - _Michel Marcus_, Apr 25 2015
%F A181787 a(2*n) = a(n). - _Robert Israel_, Aug 02 2019
%e A181787 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 A181787 N:= 200: # for a(0)..a(N)
%p A181787 A:= Array(0..N):
%p A181787 mults:= [1,3,6]:
%p A181787 for a from 1 while 3*a^2 <= N^2 do
%p A181787   if a::odd then b0:= a+1; db:= 2 else b0:= a; db:= 1 fi;
%p A181787   for b from b0 by db while a^2 + 2*b^2 <= N^2 do
%p A181787     if (a+b)::odd then c0:= b + (b mod 2); dc:= 2 else c0:= b; dc:= 1 fi;
%p A181787     for c from c0 by dc do
%p A181787       v:= a^2 + b^2 + c^2;
%p A181787       if v > N^2 then break fi;
%p A181787       if issqr(v) then
%p A181787         w:= sqrt(v);
%p A181787         A[w]:= A[w]+ mults[nops({a,b,c})];
%p A181787       fi
%p A181787 od od od:
%p A181787 convert(A,list); # _Robert Israel_, Aug 02 2019
%t A181787 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 A181787 Cf. A016725, A016727, A181786, A181788.
%K A181787 nonn,look
%O A181787 0,4
%A A181787 _T. D. Noe_, Nov 12 2010