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.

Original entry on oeis.org

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, 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, 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
Offset: 0

Views

Author

T. D. Noe, Nov 12 2010

Keywords

Comments

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

Examples

			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
		

Crossrefs

Programs

  • Maple
    N:= 200: # for a(0)..a(N)
    A:= Array(0..N):
    mults:= [1,3,6]:
    for a from 1 while 3*a^2 <= N^2 do
      if a::odd then b0:= a+1; db:= 2 else b0:= a; db:= 1 fi;
      for b from b0 by db while a^2 + 2*b^2 <= N^2 do
        if (a+b)::odd then c0:= b + (b mod 2); dc:= 2 else c0:= b; dc:= 1 fi;
        for c from c0 by dc do
          v:= a^2 + b^2 + c^2;
          if v > N^2 then break fi;
          if issqr(v) then
            w:= sqrt(v);
            A[w]:= A[w]+ mults[nops({a,b,c})];
          fi
    od od od:
    convert(A,list); # Robert Israel, Aug 02 2019
  • Mathematica
    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]

Formula

a(n) = A063691(n^2). - Michel Marcus, Apr 25 2015
a(2*n) = a(n). - Robert Israel, Aug 02 2019