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.

A000378 Sums of three squares: numbers of the form x^2 + y^2 + z^2.

This page as a plain text file.
%I A000378 #124 Feb 16 2025 08:32:21
%S A000378 0,1,2,3,4,5,6,8,9,10,11,12,13,14,16,17,18,19,20,21,22,24,25,26,27,29,
%T A000378 30,32,33,34,35,36,37,38,40,41,42,43,44,45,46,48,49,50,51,52,53,54,56,
%U A000378 57,58,59,61,62,64,65,66,67,68,69,70,72,73,74,75,76,77,78,80,81,82,83
%N A000378 Sums of three squares: numbers of the form x^2 + y^2 + z^2.
%C A000378 An equivalent definition: numbers of the form x^2 + y^2 + z^2 with x,y,z >= 0.
%C A000378 Bourgain studies "the spatial distribution of the representation of a large integer as a sum of three squares, on the small and critical scale as well as their electrostatic energy. The main results announced give strong evidence to the thesis that the solutions behave randomly. This is in sharp contrast to what happens with sums of two or four or more square." Sums of two nonzero squares are A000404. - _Jonathan Vos Post_, Apr 03 2012
%C A000378 The multiplicities for a(n) (if 0 <= x <= y <= z) are given as A000164(a(n)), n >= 1. Compare with A005875(a(n)) for integer x, y and z, and order taken into account. - _Wolfdieter Lang_, Apr 08 2013
%C A000378 a(n)^k is a member of this sequence for any k > 1. - _Boris Putievskiy_, May 05 2013
%C A000378 The selection rule for the planes with Miller indices (hkl) to undergo X-ray diffraction in a simple cubic lattice is h^2+k^2+l^2 = N where N is a term of this sequence. See A004014 for f.c.c. lattice. - _Mohammed Yaseen_, Nov 06 2022
%D A000378 J. H. Conway and N. J. A. Sloane, "Sphere Packings, Lattices and Groups", Springer-Verlag, p. 107.
%D A000378 E. Grosswald, Representations of Integers as Sums of Squares. Springer-Verlag, NY, 1985, p. 37.
%D A000378 R. K. Guy, Unsolved Problems in Number Theory, Springer, 1st edition, 1981. See section C20.
%D A000378 G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers. 3rd ed., Oxford Univ. Press, 1954, p. 311.
%H A000378 T. D. Noe, <a href="/A000378/b000378.txt">Table of n, a(n) for n = 1..10000</a>
%H A000378 Jean Bourgain, Peter Sarnak and Zeév Rudnick, <a href="http://arxiv.org/abs/1204.0134">Local statistics of lattice points on the sphere</a>, arXiv:1204.0134 [math.NT], 2012-2015.
%H A000378 J. W. Cogdell, <a href="http://www.numdam.org/item?id=JTNB_2003__15_1_33_0">On sums of three squares</a>, Journal de théorie des nombres de Bordeaux, 15 no. 1 (2003), p. 33-44.
%H A000378 L. E. Dickson, <a href="http://dx.doi.org/10.1090/S0002-9904-1927-04312-9">Integers represented by positive ternary quadratic forms</a>, Bull. Amer. Math. Soc. 33 (1927), 63-70. See Theorem I.
%H A000378 Eric T. Mortenson, <a href="https://arxiv.org/abs/1702.01627">A Kronecker-type identity and the representations of a number as a sum of three squares</a>, arXiv:1702.01627 [math.NT], 2017.
%H A000378 P. Pollack, <a href="http://www.math.dartmouth.edu/~ppollack/notes.pdf">Analytic and Combinatorial Number Theory</a> Course Notes, p. 91. [?Broken link]
%H A000378 P. Pollack, <a href="http://alpha01.dm.unito.it/personalpages/cerruti/ac/notes.pdf">Analytic and Combinatorial Number Theory</a> Course Notes, p. 91.
%H A000378 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/SquareNumber.html">Square Number</a>
%H A000378 <a href="/index/Su#ssq">Index entries for sequences related to sums of squares</a>
%F A000378 Legendre: a nonnegative integer is a sum of three squares iff it is not of the form 4^k m with m == 7 (mod 8).
%F A000378 n^(2k+1) is in the sequence iff n is in the sequence. - _Ray Chandler_, Feb 03 2009
%F A000378 Complement of A004215; complement of A000302(i)*A004771(j), i,j>=0. - _Boris Putievskiy_, May 05 2013
%F A000378 a(n) = 6n/5 + O(log n). - _Charles R Greathouse IV_, Mar 14 2014
%e A000378 a(1) = 0 = 0^2 + 0^2 + 0^2. A005875(0) = 1 = A000164(0).
%e A000378 a(9) = 9 = 0^2 + 0^2 + 3^2 =  1^2 +  2^2 + 2^2. A000164(9) = 2. A000164(9) = 30 = 2*3 + 8*3 (counting signs and order). - _Wolfdieter Lang_, Apr 08 2013
%p A000378 isA000378 := proc(n) # return true or false depending on n being in the list
%p A000378     local x,y ;
%p A000378     for x from 0 do
%p A000378         if 3*x^2 > n then
%p A000378             return false;
%p A000378         end if;
%p A000378         for y from x do
%p A000378             if x^2+2*y^2 > n then
%p A000378                 break;
%p A000378             else
%p A000378                 if issqr(n-x^2-y^2) then
%p A000378                     return true;
%p A000378                 end if;
%p A000378             end if;
%p A000378         end do:
%p A000378     end do:
%p A000378 end proc:
%p A000378 A000378 := proc(n) # generate A000378(n)
%p A000378     option remember;
%p A000378     local a;
%p A000378     if n = 1 then
%p A000378         0;
%p A000378     else
%p A000378         for a from procname(n-1)+1 do
%p A000378             if isA000378(a) then
%p A000378                 return a;
%p A000378             end if;
%p A000378         end do:
%p A000378     end if;
%p A000378 end proc:
%p A000378 seq(A000378(n),n=1..100) ; # _R. J. Mathar_, Sep 09 2015
%t A000378 okQ[n_] := If[EvenQ[k = IntegerExponent[n, 2]], m = n/2^k; Mod[m, 8] != 7, True]; Select[Range[0, 100], okQ] (* _Jean-François Alcover_, Feb 08 2016, adapted from PARI *)
%o A000378 (PARI) isA000378(n)=my(k=valuation(n, 2)); if(k%2==0, n>>=k; n%8!=7, 1)
%o A000378 (PARI) list(lim)=my(v=List(),k,t); for(x=0,sqrtint(lim\=1), for(y=0, min(sqrtint(lim-x^2),x), k=x^2+y^2; for(z=0,min(sqrtint(lim-k), y), listput(v,k+z^2)))); Set(v) \\ _Charles R Greathouse IV_, Sep 14 2015
%o A000378 (Python)
%o A000378 def valuation(n, b):
%o A000378     v = 0
%o A000378     while n > 1 and n%b == 0: n //= b; v += 1
%o A000378     return v
%o A000378 def ok(n): return n//4**valuation(n, 4)%8 != 7
%o A000378 print(list(filter(ok, range(84)))) # _Michael S. Branicky_, Jul 15 2021
%o A000378 (Python)
%o A000378 from itertools import count, islice
%o A000378 def A000378_gen(): # generator of terms
%o A000378     return filter(lambda n:n>>2*(bin(n)[:1:-1].index('1')//2) & 7 < 7, count(1))
%o A000378 A000378_list = list(islice(A000378_gen(),30)) # _Chai Wah Wu_, Jun 27 2022
%o A000378 (Python)
%o A000378 def A000378(n):
%o A000378     def f(x): return n-1+sum(((x>>(i<<1))-7>>3)+1 for i in range(x.bit_length()>>1))
%o A000378     m, k = n-1, f(n-1)
%o A000378     while m != k: m, k = k, f(k)
%o A000378     return m # _Chai Wah Wu_, Feb 14 2025
%Y A000378 Union of A000290, A000404 and A000408 (common elements).
%Y A000378 Union of A000290, A000415 and A000419 (disjunct sets).
%Y A000378 Complement of A004215.
%Y A000378 Cf. A005875 (number of representations if x, y and z are integers).
%Y A000378 Cf. A047449, A034043, A034044, A034045, A034046, A034047, A065883, A072400, A072401, A071374, A002828, A001481, A125084, A000164.
%K A000378 nonn
%O A000378 1,3
%A A000378 _N. J. A. Sloane_
%E A000378 More terms from _Ray Chandler_, Sep 05 2004