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.

Showing 1-10 of 199 results. Next

A205963 a(n) = Fibonacci(n)*A000118(n) for n>=1 with a(0)=1, where A000118(n) is the number of ways of writing n as a sum of 4 squares.

Original entry on oeis.org

1, 8, 24, 64, 72, 240, 768, 832, 504, 3536, 7920, 8544, 13824, 26096, 72384, 117120, 23688, 229968, 806208, 668960, 974160, 2802176, 5100768, 5502144, 4451328, 18606200, 40788048, 62853760, 61019712, 123414960, 479255040, 344644864, 52279416, 1353437952, 2463647184
Offset: 0

Views

Author

Paul D. Hanna, Feb 03 2012

Keywords

Comments

Compare g.f. to the Lambert series of A000118: 1 + 8*Sum_{n>=1} n*x^n/(1 + (-x)^n).

Examples

			G.f.: A(x) = 1 + 8*x + 24*x^2 + 64*x^3 + 72*x^4 + 240*x^5 + 768*x^6 +...
where A(x) = 1 + 1*8*x + 1*24*x^2 + 2*32*x^3 + 3*24*x^4 + 5*48*x^5 + 8*96*x^6 + 13*64*x^7 + 21*24*x^8 +...+ Fibonacci(n)*A000118(n)*x^n +...
The g.f. is also given by the identity:
A(x) = 1 + 8*( 1*1*x/(1-x-x^2) + 1*2*x^2/(1+3*x^2+x^4) + 2*3*x^3/(1-4*x^3-x^6) + 3*4*x^4/(1+7*x^4+x^8) + 5*5*x^5/(1-11*x^5-x^10) + 8*6*x^6/(1+18*x^6+x^12) + 13*7*x^7/(1-29*x^7-x^14) +...).
		

Crossrefs

Cf. A209443 (Pell variant).

Programs

  • Mathematica
    Join[{1}, Table[Fibonacci[n]*SquaresR[4, n], {n,1,50}]] (* G. C. Greubel, Mar 09 2017 *)
  • PARI
    {Lucas(n)=fibonacci(n-1)+fibonacci(n+1)}
    {a(n)=polcoeff(1+8*sum(m=1,n,fibonacci(m)*m*x^m/(1+Lucas(m)*(-x)^m+(-1)^m*x^(2*m)+x*O(x^n))),n)}
    for(n=0,31,print1(a(n),", "))

Formula

G.f.: 1 + 8*Sum_{n>=1} Fibonacci(n)*n*x^n/(1 + Lucas(n)*(-x)^n + (-1)^n*x^(2*n)).

A267326 Number of ways writing n^2 as a sum of four squares: a(n) = A000118(n^2).

Original entry on oeis.org

1, 8, 24, 104, 24, 248, 312, 456, 24, 968, 744, 1064, 312, 1464, 1368, 3224, 24, 2456, 2904, 3048, 744, 5928, 3192, 4424, 312, 6248, 4392, 8744, 1368, 6968, 9672, 7944, 24, 13832, 7368, 14136, 2904, 11256, 9144, 19032, 744, 13784, 17784, 15144, 3192
Offset: 0

Views

Author

Christopher Heiling, Jan 13 2016

Keywords

Comments

For all pair of relatively prime numbers k, m this sequence is multiplicative with a factor of 8: a(k*m) = 8*a(k)*a(m). - Christopher Heiling, Apr 02 2017

Examples

			For n = 2 the a(n) = 24 solutions of x^2 + y^2 + z^2 + t^2 = 2^2 are:
{x,y,z,t} = {{0,0,0,2};{0,0,0,-2};{0,0,2,0};{0,0,-2,0};{0,2,0,0};{0,-2,0,0};{2,0,0,0};{-2,0,0,0};{1,1,1,1};{1,1,1,-1};{1,1,-1,1};{1,-1,1,1};{-1,1,1,1};{1,1,-1,-1};{1,-1,1,-1};{-1,1,1,-1};{1,-1,-1,1};{-1,1,-1,1};{1,-1,-1,-1};{-1,1,-1,-1};{-1,-1,1,-1};{-1,-1,1,-1};{-1,-1,-1,1};{-1,-1,-1,-1}}.
		

Crossrefs

Cf. A000118.
Partial sums of this sequence give A264390.
Column k=4 of A302996.

Programs

  • Maple
    terms := 42:
    (add(q^(m^2), m = -terms..terms))^4:
    seq(coeff(%, q, n^2), n = 0..terms); # Peter Bala, Jan 15 2016
  • Mathematica
    a[n_] := SquaresR[4, n^2];
    Table[a[n], {n, 0, 50}] (* Jean-François Alcover, May 18 2023 *)

Formula

a(n) = A264390(n) - A264390(n-1) for n > 1 and a(1) = A264390(1) = 2*D.
a(n) = 8*sigma(n^2) if n is odd else 24*sigma(m(n^2)), where sigma(n) = A000203(n) and m(n) = A000265(n) is the largest odd divisor of n. - Peter Bala, Jan 15 2016
a(p^(k+1)) = 8*(p^2 *a(p^k)+p+1) for p prime. In particular a(p) = 8*(p^2+p+1). - Christopher Heiling, Apr 02 2017

Extensions

a(0)=1 prepended by Alois P. Heinz, Mar 10 2023

A209443 a(n) = Pell(n)*A000118(n) for n>=1 with a(0)=1, where A000118(n) is the number of ways of writing n as a sum of 4 squares.

Original entry on oeis.org

1, 8, 48, 160, 288, 1392, 6720, 10816, 9792, 102440, 342432, 551136, 1330560, 3747632, 15510144, 37444800, 11299968, 163683216, 856193520, 1060017440, 2303197632, 9885175040, 26848039104, 43211266752, 52160613120, 325311054008, 1064050163232, 2446518414400
Offset: 0

Views

Author

Paul D. Hanna, Mar 09 2012

Keywords

Comments

Compare g.f. to the Lambert series of A000118: 1 + 8*Sum_{n>=1} n*x^n/(1+(-x)^n).

Examples

			G.f.: A(x) = 1 + 8*x + 48*x^2 + 160*x^3 + 288*x^4 + 1392*x^5 + 6720*x^6 +...
where A(x) = 1 + 1*8*x + 2*24*x^2 + 5*32*x^3 + 12*24*x^4 + 29*48*x^5 + 70*96*x^6 + 169*64*x^7 + 408*24*x^8 +...+ Pell(n)*A000118(n)*x^n +...
The g.f. is also given by the identity:
A(x) = 1 + 8*( 1*1*x/(1-2*x-x^2) + 2*2*x^2/(1+6*x^2+x^4) + 5*3*x^3/(1-14*x^3-x^6) + 12*4*x^4/(1+34*x^4+x^8) + 29*5*x^5/(1-82*x^5-x^10) + 70*6*x^6/(1+198*x^6+x^12) + 169*7*x^7/(1-478*x^7-x^14) +...).
		

Crossrefs

Programs

  • Mathematica
    A000118[n_]:= If[n < 1, Boole[n == 0], 8*Sum[If[Mod[d, 4] > 0, d, 0], {d, Divisors@n}]]; Join[{1}, Table[Fibonacci[n, 2]*A000118[n], {n, 1, 50}]] (* G. C. Greubel, Jan 02 2018 *)
  • PARI
    {Pell(n)=polcoeff(x/(1-2*x-x^2+x*O(x^n)),n)}
    {A002203(n)=Pell(n-1)+Pell(n+1)}
    {a(n)=polcoeff(1+8*sum(m=1,n,Pell(m)*m*x^m/(1+A002203(m)*(-x)^m+(-1)^m*x^(2*m)+x*O(x^n))),n)}
    for(n=0,30,print1(a(n),", "))

Formula

G.f.: 1 + 8*Sum_{n>=1} Pell(n)*n*x^n/(1 + A002203(n)*(-x)^n + (-1)^n*x^(2*n)).

A128689 Numbers k such that A000118(k) is a record.

Original entry on oeis.org

0, 1, 2, 3, 5, 6, 9, 10, 14, 18, 26, 30, 42, 54, 66, 78, 90, 114, 126, 150, 186, 198, 210, 270, 330, 378, 390, 450, 510, 546, 570, 630, 798, 810, 882, 930, 990, 1050, 1170, 1350, 1386, 1470, 1530, 1638, 1650, 1710, 1890, 2250, 2310, 2610, 2730, 2970, 3150, 3510, 3570
Offset: 1

Views

Author

Jonathan Vos Post, Mar 21 2007

Keywords

Comments

This sequence is equivalent to numbers k such that sigma(k) > sigma(m) for all m < k where m and k are not multiples of 4 as no terms are multiples of 4 and A000118(n) = 8*sigma(n) for nonmultiples of 4. - David A. Corneth, May 19 2023

Crossrefs

Cf. A000118 (number of ways of writing n as a sum of 4 squares), A002093, A042968 A128690.

Programs

  • Mathematica
    f[n_] := SquaresR[4, n];
    Module[{record = -1, n}, Reap[For[n = 0, n <= 2000, n++, If[f[n] > record, record = f[n]; Sow[n]]]][[2, 1]]] (* Jean-François Alcover, May 18 2023 *)
    DeleteDuplicates[Table[{n,SquaresR[4,n]},{n,0,3600}],GreaterEqual[#1[[2]],#2[[2]]]&][[;;,1]] (* Harvey P. Dale, Jun 20 2024 *)

Extensions

Missing term 378 added by Giovanni Resta, Jun 18 2016
More terms from Jean-François Alcover, May 18 2023
More terms from David A. Corneth, May 18 2023

A128690 Records in A000118.

Original entry on oeis.org

1, 8, 24, 32, 48, 96, 104, 144, 192, 312, 336, 576, 768, 960, 1152, 1344, 1872, 1920, 2496, 2976, 3072, 3744, 4608, 5760, 6912, 7680, 8064, 9672, 10368, 10752, 11520, 14976, 15360, 17424, 17784, 18432, 22464, 23808, 26208, 29760, 29952, 32832, 33696, 34944, 35712, 37440, 46080
Offset: 1

Views

Author

Jonathan Vos Post, Mar 21 2007

Keywords

Crossrefs

Cf. A000118 (number of ways of writing n as a sum of 4 squares), A128689.

Programs

  • Mathematica
    f[n_] := SquaresR[4, n];
    Module[{record = -1, n}, Reap[For[n = 0, n <= 2000, n++, If[f[n] > record, record = f[n]; Sow[record]]]][[2, 1]]] (* Jean-François Alcover, May 18 2023 *)

Formula

a(n) = A000118(A128689(n)). - Michel Marcus, May 19 2023

Extensions

Data corrected by Giovanni Resta, Jun 18 2016
More terms from Jean-François Alcover, May 18 2023

A333173 a(n) = r_4(n^2 + 1), where r_4(k) is the number of ways of writing k as a sum of 4 squares (A000118).

Original entry on oeis.org

8, 24, 48, 144, 144, 336, 304, 744, 672, 1008, 816, 1488, 1440, 2592, 1584, 2736, 2064, 4320, 3472, 4368, 3216, 6048, 4704, 7776, 4624, 7536, 5424, 10656, 7584, 10128, 7776, 12768, 10416, 15840, 10080, 14736, 10384, 19872, 14736, 18288, 12816, 20904, 16992, 28272
Offset: 0

Views

Author

Amiram Eldar, Mar 09 2020

Keywords

Examples

			a(0) = r_4(0^2 + 1) = r_4(1) = A000118(1) = 8.
		

Crossrefs

Programs

  • Mathematica
    Table[SquaresR[4, k^2 + 1], {k, 0, 100}]

Formula

a(n) = A000118(A002522(n)).

A333174 a(n) = Sum_{k=0..n} r_4(k^2 + 1), where r_4(k) is the number of ways of writing k as a sum of 4 squares (A000118).

Original entry on oeis.org

8, 32, 80, 224, 368, 704, 1008, 1752, 2424, 3432, 4248, 5736, 7176, 9768, 11352, 14088, 16152, 20472, 23944, 28312, 31528, 37576, 42280, 50056, 54680, 62216, 67640, 78296, 85880, 96008, 103784, 116552, 126968, 142808, 152888, 167624, 178008, 197880, 212616, 230904
Offset: 0

Views

Author

Amiram Eldar, Mar 09 2020

Keywords

Examples

			a(0) = r_4(0^2 + 1) = r_4(1) = A000118(1) = 8.
a(1) = r_4(0^2 + 1) + r_4(1^1 + 1) = r_4(1) + r_4(2) = A000118(1) + A000118(2) = 8 + 24 = 32.
		

Crossrefs

Partial sums of A333173.

Programs

  • Mathematica
    Accumulate @ Table[SquaresR[4, k^2 + 1], {k, 0, 100}]

Formula

a(n) ~ (40*G/Pi^2) * n^3, where G is Catalan's constant (A006752).

A271518 Number of ordered ways to write n as w^2 + x^2 + y^2 + z^2 with x + 3*y + 5*z a square, where w, x, y and z are nonnegative integers.

Original entry on oeis.org

1, 2, 2, 2, 2, 1, 1, 1, 1, 3, 3, 2, 2, 2, 4, 2, 2, 5, 5, 3, 2, 2, 2, 3, 1, 5, 5, 2, 2, 5, 8, 1, 2, 6, 3, 3, 2, 3, 7, 5, 2, 8, 6, 1, 4, 6, 6, 2, 2, 6, 9, 5, 4, 3, 7, 6, 2, 6, 7, 5, 2, 1, 6, 6, 2, 10, 9, 6, 3, 3, 6, 2, 3, 8, 12, 5, 5, 7, 11, 5, 1
Offset: 0

Views

Author

Zhi-Wei Sun, Apr 09 2016

Keywords

Comments

Conjecture: (i) a(n) > 0 for all n = 0,1,2,..., and a(n) = 1 only for n = 0, 4^k*6 (k = 0,1,2,...), 16^k*m (k = 0,1,2,... and m = 5, 7, 8, 31, 43, 61, 116).
(ii) Any integer n > 15 can be written as w^2 + x^2 + y^2 + z^2 with w, x, y, z nonnegative integers and 6*x + 10*y + 12*z a square.
(iii) Each nonnegative integer n not among 7, 15, 23, 71, 97 can be written as w^2 + x^2 + y^2 + z^2 with w, x, y, z nonnegative integers and 2*x + 6*y + 10*z a square. Also, any nonnegative integer n not among 7, 43, 79 can be written as w^2 + x^2 + y^2 + z^2 with w, x, y, z nonnegative integers and 3*x + 5*y + 6*z a square.
See also A271510 and A271513 for related conjectures.
a(n) > 0 verified for all n <= 3*10^7. - Zhi-Wei Sun, Nov 28 2016
Qing-Hu Hou at Tianjin Univ. has verified a(n) > 0 and parts (ii) and (iii) of the above conjecture for n up to 10^9. - Zhi-Wei Sun, Dec 04 2016
The conjecture that a(n) > 0 for all n = 0,1,2,... is called the 1-3-5-Conjecture and the author has announced a prize of 1350 US dollars for its solution. - Zhi-Wei Sun, Jan 17 2017
Qing-Hu Hou has finished his verification of a(n) > 0 for n up to 10^10. - Zhi-Wei Sun, Feb 17 2017
The 1-3-5 conjecture was finally proved by António Machiavelo and Nikolaos Tsopanidis in a JNT paper published in 2021. This is a great achivement! - Zhi-Wei Sun, Mar 31 2021

Examples

			a(5) = 1 since 5 = 2^2 + 1^2 + 0^2 + 0^2 with 1 + 3*0 + 5*0 = 1^2.
a(6) = 1 since 6 = 2^2 + 1^2 + 1^2 + 0^2 with 1 + 3*1 + 5*0 = 2^2.
a(7) = 1 since 7 = 2^2 + 1^2 + 1^2 + 1^2 with 1 + 3*1 + 5*1 = 3^2.
a(8) = 1 since 8 = 0^2 + 0^2 + 2^2 + 2^2 with 0 + 3*2 + 5*2 = 4^2.
a(24) = 1 since 24 = 4^2 + 0^2 + 2^2 + 2^2 with 0 + 3*2 + 5*2 = 4^2.
a(31) = 1 since 31 = 1^2 + 5^2 + 2^2 + 1^2 with 5 + 3*2 + 5*1 = 4^2.
a(43) = 1 since 43 = 1^2 + 1^2 + 5^2 + 4^2 with 1 + 3*5 + 5*4 = 6^2.
a(61) = 1 since 61 = 6^2 + 0^2 + 0^2 + 5^2 with 0 + 3*0 + 5*5 = 5^2.
a(116) = 1 since 116 = 10^2 + 4^2 + 0^2 + 0^2 with 4 + 3*0 + 5*0 = 2^2.
		

Crossrefs

Programs

  • Mathematica
    SQ[n_]:=SQ[n]=IntegerQ[Sqrt[n]]
    Do[r=0;Do[If[SQ[n-x^2-y^2-z^2]&&SQ[x+3y+5z],r=r+1],{x,0,Sqrt[n]},{y,0,Sqrt[n-x^2]},{z,0,Sqrt[n-x^2-y^2]}];Print[n," ",r];Continue,{n,0,80}]

A004215 Numbers that are the sum of 4 but no fewer nonzero squares.

Original entry on oeis.org

7, 15, 23, 28, 31, 39, 47, 55, 60, 63, 71, 79, 87, 92, 95, 103, 111, 112, 119, 124, 127, 135, 143, 151, 156, 159, 167, 175, 183, 188, 191, 199, 207, 215, 220, 223, 231, 239, 240, 247, 252, 255, 263, 271, 279, 284, 287, 295, 303, 311, 316, 319, 327, 335, 343
Offset: 1

Views

Author

Keywords

Comments

Lagrange's theorem tells us that each positive integer can be written as a sum of four squares.
If n is in the sequence and k is an odd positive integer then n^k is in the sequence because n^k is of the form 4^i(8j+7). - Farideh Firoozbakht, Nov 23 2006
Numbers whose cubes do not have a partition as a sum of 3 squares. a(n)^3 = A134738(n). - Artur Jasinski, Nov 07 2007
A002828(a(n)) = 4; A025427(a(n)) > 0. - Reinhard Zumkeller, Feb 26 2015
There are infinitely many adjacent pairs (for example, 128n + 111 and 128n + 112 for any n), but never a triple of consecutive integers. - Ivan Neretin, Aug 17 2017
These numbers are called "forbidden numbers" in crystallography: for a cubic crystal, no reflection with index hkl such that h^2 + k^2 + l^2 = a(n) appears in the crystal's diffraction pattern. - A. Timothy Royappa, Aug 11 2021

Examples

			15 is in the sequence because it is the sum of four squares, namely, 3^2 + 2^2 + 1^2 + 1^2, and it can't be expressed as the sum of fewer squares.
16 is not in the sequence, because, although it can be expressed as 2^2 + 2^2 + 2^2 + 2^2, it can also be expressed as 4^2.
		

References

  • L. E. Dickson, History of the Theory of Numbers. Carnegie Institute Public. 256, Washington, DC, Vol. 1, 1919; Vol. 2, 1920; Vol. 3, 1923, see vol. 2, p. 261.
  • G. H. Hardy, Ramanujan: twelve lectures on subjects suggested by his life and work, Cambridge, University Press, 1940, p. 12.
  • E. Poznanski, 1901. Pierwiastki pierwotne liczb pierwszych. Warszawa, pp. 1-63.
  • W. Sierpiński, 1925. Teorja Liczb. pp. 1-410 (p. 125).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • David Wells, The Penguin Dictionary of Curious and Interesting Numbers, entry 4181.

Crossrefs

Complement of A000378.
Cf. A000118 (ways to write n as sum of 4 squares), A025427.

Programs

  • Haskell
    a004215 n = a004215_list !! (n-1)
    a004215_list = filter ((== 4) . a002828) [1..]
    -- Reinhard Zumkeller, Feb 26 2015
    
  • Maple
    N:= 1000: # to get all terms <= N
    {seq(seq(4^i * (8*j + 7), j = 0 .. floor((N/4^i - 7)/8)), i = 0 .. floor(log[4](N)))}; # Robert Israel, Sep 02 2014
  • Mathematica
    Sort[Flatten[Table[4^i(8j + 7), {i, 0, 2}, {j, 0, 42}]]] (* Alonso del Arte, Jul 05 2005 *)
    Select[Range[120], Mod[ #/4^IntegerExponent[ #, 4], 8] == 7 &] (* Ant King, Oct 14 2010 *)
  • PARI
    isA004215(n)={ local(fouri,j) ; fouri=1 ; while( n >=7*fouri, if( n % fouri ==0, j= n/fouri -7 ; if( j % 8 ==0, return(1) ) ; ) ; fouri *= 4 ; ) ; return(0) ; } { for(n=1,400, if(isA004215(n), print1(n,",") ; ) ; ) ; } \\ R. J. Mathar, Nov 22 2006
    
  • PARI
    isA004215(n)= n\4^valuation(n,4)%8==7 \\ M. F. Hasler, Mar 18 2011
    
  • Python
    def valuation(n, b):
        v = 0
        while n > 1 and n%b == 0: n //= b; v += 1
        return v
    def ok(n): return n//4**valuation(n, 4)%8 == 7 # after M. F. Hasler
    print(list(filter(ok, range(344)))) # Michael S. Branicky, Jul 15 2021
    
  • Python
    from itertools import count, islice
    def A004215_gen(startvalue=1): # generator of terms >= startvalue
        return filter(lambda n:not (m:=(~n&n-1).bit_length())&1 and (n>>m)&7==7,count(max(startvalue,1)))
    A004215_list = list(islice(A004215_gen(),30)) # Chai Wah Wu, Jul 09 2022
    
  • Python
    def A004215(n):
        def bisection(f,kmin=0,kmax=1):
            while f(kmax) > kmax: kmax <<= 1
            kmin = kmax >> 1
            while kmax-kmin > 1:
                kmid = kmax+kmin>>1
                if f(kmid) <= kmid:
                    kmax = kmid
                else:
                    kmin = kmid
            return kmax
        def f(x): return n+x-sum(((x>>(i<<1))-7>>3)+1 for i in range(x.bit_length()>>1))
        return bisection(f,n,n) # Chai Wah Wu, Feb 14 2025

Formula

a(n) = A055039(n)/2. - Ray Chandler, Jan 30 2009
Numbers of the form 4^i*(8*j+7), i >= 0, j >= 0. [A.-M. Legendre & C. F. Gauss]
Products of the form A000302(i)*A004771(j), i, j >= 0. - R. J. Mathar, Nov 29 2006
a(n) = 6*n + O(log(n)). - Charles R Greathouse IV, Dec 19 2013
Conjecture: The number of terms < 2^n is A023105(n) - 2. - Tilman Neumann, Sep 20 2020

Extensions

More terms from Arlin Anderson (starship1(AT)gmail.com)
Additional comments from Jud McCranie, Mar 19 2000

A005875 Theta series of simple cubic lattice; also number of ways of writing a nonnegative integer n as a sum of 3 squares (zero being allowed).

Original entry on oeis.org

1, 6, 12, 8, 6, 24, 24, 0, 12, 30, 24, 24, 8, 24, 48, 0, 6, 48, 36, 24, 24, 48, 24, 0, 24, 30, 72, 32, 0, 72, 48, 0, 12, 48, 48, 48, 30, 24, 72, 0, 24, 96, 48, 24, 24, 72, 48, 0, 8, 54, 84, 48, 24, 72, 96, 0, 48, 48, 24, 72, 0, 72, 96, 0, 6, 96, 96, 24, 48, 96, 48, 0, 36, 48, 120
Offset: 0

Views

Author

Keywords

Comments

Number of ordered triples (i, j, k) of integers such that n = i^2 + j^2 + k^2.
The Madelung Coulomb energy for alternating unit charges in the simple cubic lattice is Sum_{n>=1} (-1)^n*a(n)/sqrt(n) = -A085469. - R. J. Mathar, Apr 29 2006
a(A004215(k))=0 for k=1,2,3,... but no other elements of {a(n)} are zero. - Graeme McRae, Jan 15 2007

Examples

			Order and signs are taken into account: a(1) = 6 from 1 = (+-1)^2 + 0^2 + 0^2, a(2) = 12 from 2 = (+-1)^2 + (+-1)^2 + 0^2; a(3) = 8 from 3 = (+-1)^2 + (+-1)^2 + (+-1)^2, etc.
G.f. =  1 + 6*q + 12*q^2 + 8*q^3 + 6*q^4 + 24*q^5 + 24*q^6 + 12*q^8 + 30*q^9 + 24*q^10 + ...
		

References

  • H. Cohen, Number Theory, Vol. 1: Tools and Diophantine Equations, Springer-Verlag, 2007, p. 317.
  • J. H. Conway and N. J. A. Sloane, "Sphere Packings, Lattices and Groups", Springer-Verlag, p. 107.
  • H. Davenport, The Higher Arithmetic. Cambridge Univ. Press, 7th ed., 1999, Chapter V.
  • L. E. Dickson, History of the Theory of Numbers. Carnegie Institute Public. 256, Washington, DC, Vol. 1, 1919; Vol. 2, 1920; Vol. 3, 1923, see vol. 3, p. 109.
  • E. Grosswald, Representations of Integers as Sums of Squares. Springer-Verlag, NY, 1985, p. 54.
  • L. Kronecker, Crelle, Vol. LVII (1860), p. 248; Werke, Vol. IV, p. 188.
  • C. J. Moreno and S. S. Wagstaff, Jr., Sums of Squares of Integers, Chapman and Hall, 2006, p. 43.
  • T. Nagell, Introduction to Number Theory, Wiley, 1951, p. 194.
  • W. Sierpiński, 1925. Teorja Liczb. pp. 1-410 (p.61).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • H. J. S. Smith, Report on the Theory of Numbers, reprinted in Vol. 1 of his Collected Math. Papers, Chelsea, NY, 1979, see p. 338, Eq. (B').

Crossrefs

Row d=3 of A122141 and of A319574, 3rd column of A286815.
Cf. A074590 (primitive solutions), A117609 (partial sums), A004215 (positions of zeros).
Analog for 4 squares: A000118.
x^2+y^2+k*z^2: A005875, A014455, A034933, A169783, A169784.
Ramanujan theta functions: f(q) (see A121373), phi(q) (A000122), psi(q) (A010054), chi(q) (A000700).

Programs

  • Julia
    # JacobiTheta3 is defined in A000122.
    A005875List(len) = JacobiTheta3(len, 3)
    A005875List(75) |> println # Peter Luschny, Mar 12 2018
    
  • Magma
    Basis( ModularForms( Gamma1(4), 3/2), 75) [1]; /* Michael Somos, Jun 25 2014 */
    
  • Maple
    (sum(x^(m^2),m=-10..10))^3; seq(coeff(%,x,n), n=0..50);
    Alternative:
    A005875list := proc(len) series(JacobiTheta3(0, x)^3, x, len+1);
    seq(coeff(%, x, j), j=0..len-1) end: A005875list(75); # Peter Luschny, Oct 02 2018
  • Mathematica
    SquaresR[3,Range[0,80]] (* Harvey P. Dale, Jul 21 2011 *)
    a[ n_] := SeriesCoefficient[ EllipticTheta[ 3, 0, q]^3, {q, 0, n}]; (* Michael Somos, Jun 25 2014 *)
    a[ n_] := Length @ FindInstance[ n == x^2 + y^2 + z^2, {x, y, z}, Integers, 10^9]; (* Michael Somos, May 21 2015 *)
    QP = QPochhammer; CoefficientList[(QP[q^2]^5/(QP[q]*QP[q^4])^2)^3 + O[q]^80, q] (* Jean-François Alcover, Nov 24 2015 *)
  • PARI
    {a(n) = if( n<0, 0, polcoeff( sum( k=1, sqrtint(n), 2 * x^k^2, 1 + x * O(x^n))^3, n))};
    
  • PARI
    {a(n) = my(A); if( n<0, 0, A = x * O(x^n); polcoeff( (eta(x^2 + A)^5 / (eta(x + A) * eta(x^4 + A))^2)^3, n))}; /* Michael Somos, Jun 03 2012 */
    
  • PARI
    {a(n) = my(G); if( n<0, 0, G = [ 1, 0, 0; 0, 1, 0; 0, 0, 1]; polcoeff( 1 + 2 * x * Ser( qfrep( G, n)), n))}; /* Michael Somos, May 21 2015 */
    
  • Python
    # uses Python code for A004018
    from math import isqrt
    def A005875(n): return A004018(n)+(sum(A004018(n-k**2) for k in range(1,isqrt(n)+1))<<1) # Chai Wah Wu, Jun 21 2024
  • Sage
    Q = DiagonalQuadraticForm(ZZ, [1]*3)
    Q.representation_number_list(75) # Peter Luschny, Jun 20 2014
    

Formula

A number n is representable as the sum of 3 squares iff n is not of the form 4^a (8k+7) (cf. A000378).
There is a classical formula (essentially due to Gauss):
For sums of 3 squares r_3(n): write (uniquely) -n=D(2^vf)^2, with D<0 fundamental discriminant, f odd, v>=-1. Then r_3(n) = 12L((D/.),0)(1-(D/2)) Sum_{d | f} mu(d)(D/d)sigma(f/d).
Here mu is the Moebius function, (D/2) and (D/d) are Kronecker-Legendre symbols, sigma is the sum of divisors function, L((D/.),0)=h(D)/(w(D)/2) is the value at 0 of the L function of the quadratic character (D/.), equal to the class number h(D) divided by 2 or 3 in the special cases D=-4 and -3. - Henri Cohen (Henri.Cohen(AT)math.u-bordeaux1.fr), May 12 2010
a(n) = 3*T(n) if n == 1,2,5,6 mod 8, = 2*T(n) if n == 3 mod 8, = 0 if n == 7 mod 8 and = a(n/4) if n == 0 mod 4, where T(n) = A117726(n). [Moreno-Wagstaff].
"If 12E(n) is the number of representations of n as a sum of three squares, then E(n) = 2F(n) - G(n) where G(n) = number of classes of determinant -n, F(n) = number of uneven classes." - Dickson, quoting Kronecker. [Cf. A117726.]
a(n) = Sum_{d^2|n} b(n/d^2), where b() = A074590() gives the number of primitive solutions.
Expansion of phi(q)^3 in powers of q where phi() is a Ramanujan theta function. - Michael Somos, Oct 25 2006.
Euler transform of period 4 sequence [ 6, -9, 6, -3, ...]. - Michael Somos, Oct 25 2006
G.f.: (Sum_{k in Z} x^(k^2))^3.
a(8*n + 7) = 0. a(4*n) = a(n).
a(n) = A004015(2*n) = A014455(2*n) = A004013(4*n) = A169783(4*n). a(4*n + 1) = 6 * A045834(n). a(8*n + 3) = 8 * A008443(n). a(8*n + 5) = 24 * A045831(n). - Michael Somos, Jun 03 2012
a(4*n + 2) = 12 * A045828(n). - Michael Somos, Sep 03 2014
a(n) = (-1)^n * A213384(n). - Michael Somos, May 21 2015
a(n) = (6/n)*Sum_{k=1..n} A186690(k)*a(n-k), a(0) = 1. - Seiichi Manyama, May 27 2017
a(n) = A004018(n) + 2*Sum_{k=1..floor(sqrt(n))} A004018(n - k^2). - Daniel Suteu, Aug 27 2021
Convolution cube of A000122. Convolution of A004018 and A000122. - R. J. Mathar, Aug 03 2025

Extensions

More terms from James Sellers, Aug 22 2000
Showing 1-10 of 199 results. Next