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 25 results. Next

A000122 Expansion of Jacobi theta function theta_3(x) = Sum_{m =-oo..oo} x^(m^2) (number of integer solutions to k^2 = n).

Original entry on oeis.org

1, 2, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0
Offset: 0

Views

Author

Keywords

Comments

Ramanujan theta functions: f(q) (see A121373), phi(q) (the present sequence), psi(q) (A010054), chi(q) (A000700).
Theta series of the one-dimensional lattice Z.
Also, essentially the same as the theta series of the one-dimensional lattices A_1, A*_1, D_1, D*_1.
Number of ways of writing n as a square.
Closely related: theta_4(x) = Sum_{m = -oo..oo} (-x)^(m^2). See A002448.
Number 6 of the 14 primitive eta-products which are holomorphic modular forms of weight 1/2 listed by D. Zagier on page 30 of "The 1-2-3 of Modular Forms". - Michael Somos, May 04 2016

Examples

			G.f. = 1 + 2*q + 2*q^4 + 2*q^9 + 2*q^16 + 2*q^25 + 2*q^36 + 2*q^49 + 2*q^64 + 2*q^81 + ...
		

References

  • Tom M. Apostol, Modular Functions and Dirichlet Series in Number Theory, Second edition, Springer, 1990, Exercise 1, p. 91.
  • Richard Bellman, A Brief Introduction to Theta Functions, Dover, 2013.
  • J. M. Borwein and P. B. Borwein, Pi and the AGM, Wiley, 1987, p. 64.
  • L. Comtet, Advanced Combinatorics, Reidel, 1974, p. 104, [5n].
  • J. H. Conway and N. J. A. Sloane, "Sphere Packings, Lattices and Groups", Springer-Verlag, p. 102.
  • N. J. Fine, Basic Hypergeometric Series and Applications, Amer. Math. Soc., 1988; p. 93, Eq. (34.1); p. 78, Eq. (32.22).
  • G. H. Hardy, Ramanujan: twelve lectures on subjects suggested by his life and work, Cambridge, University Press, 1940, p. 133.
  • G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers, Sixth Edition, Clarendon Press, Oxford, 2009, Theorem 352, p. 372.
  • J. Tannery and J. Molk, Eléments de la Théorie des Fonctions Elliptiques, Vol. 2, Gauthier-Villars, Paris, 1902; Chelsea, NY, 1972, see p. 27.
  • E. T. Whittaker and G. N. Watson, A Course of Modern Analysis, Cambridge Univ. Press, 4th ed., 1963, p. 464.

Crossrefs

1st column of A286815. - Seiichi Manyama, May 27 2017
Row d=1 of A122141.
Cf. A002448 (theta_4). Partial sums give A001650.
Cf. A000007, A004015, A004016, A008444, A008445, A008446, A008447, A008448, A008449 (Theta series of lattices A_0, A_3, A_2, A_4, ...).

Programs

  • Julia
    using Nemo
    function JacobiTheta3(len, r)
        R, x = PolynomialRing(ZZ, "x")
        e = theta_qexp(r, len, x)
        [fmpz(coeff(e, j)) for j in 0:len - 1] end
    A000122List(len) = JacobiTheta3(len, 1)
    A000122List(105) |> println # Peter Luschny, Mar 12 2018
    
  • Magma
    Basis( ModularForms( Gamma0(4), 1/2), 100) [1]; /* Michael Somos, Jun 10 2014 */
    
  • Magma
    L := Lattice("A",1); A := ThetaSeries(L, 20); A; /* Michael Somos, Nov 13 2014 */
    
  • Maple
    add(x^(m^2),m=-10..10): seq(coeff(%,x,n), n=0..100);
    # alternative
    A000122 := proc(n)
        if n = 0 then
            1;
        elif issqr(n) then
            2;
        else
            0 ;
        end if;
    end proc:
    seq(A000122(n),n=0..100) ; # R. J. Mathar, Feb 22 2021
  • Mathematica
    a[ n_] := SeriesCoefficient[ EllipticTheta[ 3, 0, q], {q, 0, n}]; (* Michael Somos, Jul 11 2011 *)
    CoefficientList[ Sum[ x^(m^2), {m, -(n=10), n} ], x ]
    SquaresR[1, Range[0, 104]] (* Robert G. Wilson v, Jul 16 2014 *)
    QP = QPochhammer; s = QP[q^2]^5/(QP[q]*QP[q^4])^2 + O[q]^105; CoefficientList[s, q] (* Jean-François Alcover, Nov 24 2015 *)
    (4 QPochhammer[q^2]/QPochhammer[-1,-q]^2 + O[q]^101)[[3]] (* Vladimir Reshetnikov, Sep 16 2016 *)
  • 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, n))}; /* Michael Somos, Mar 14 2011 */
    
  • PARI
    {a(n) = issquare(n) * 2 -(n==0)}; /* Michael Somos, Jun 17 1999 */
    
  • Python
    from sympy.ntheory.primetest import is_square
    def A000122(n): return is_square(n)<<1 if n else 1 # Chai Wah Wu, May 17 2023
  • Sage
    Q = DiagonalQuadraticForm(ZZ, [1])
    Q.representation_number_list(105) # Peter Luschny, Jun 20 2014
    

Formula

Expansion of eta(q^2)^5 / (eta(q)*eta(q^4))^2 in powers of q.
Euler transform of period 4 sequence [2, -3, 2, -1, ...].
G.f. A(x) satisfies 0 = f(A(x), A(x^2), A(x^4)) where f(u, v, w) = u^2 - v^2 + 2 * w * (w - u). - Michael Somos, Jul 20 2004
G.f. A(x) satisfies 0 = f(A(x), A(x^3), A(x^9)) where f(u, v, w) = w^4 - v^4 + w * (u - w)^3. - Michael Somos, May 11 2019
G.f.: Sum_{m=-oo..oo} x^(m^2);
a(0) = 1; for n > 0, a(n) = 0 unless n is a square when a(n) = 2.
G.f.: Product_{k>0} (1 - x^(2*k))*(1 + x^(2*k-1))^2.
G.f.: s(2)^5/(s(1)^2*s(4)^2), where s(k) := subs(q=q^k, eta(q)), where eta(q) is Dedekind's function, cf. A010815. [Fine]
The Jacobi triple product identity states that for |x| < 1, z != 0, Product_{n>0} {(1-x^(2n))(1+x^(2n-1)z)(1+x^(2n-1)/z)} = Sum_{n=-inf..inf} x^(n^2)*z^n. Set z=1 to get theta_3(x).
For n > 0, a(n) = 2*(floor(sqrt(n))-floor(sqrt(n-1))). - Mikael Aaltonen, Jan 17 2015
G.f. is a period 1 Fourier series which satisfies f(-1/(4 t)) = 2^(1/2) (t/i)^(1/2) f(t) where q = exp(2 Pi i t). - Michael Somos, May 05 2016
a(n) = A000132(n)(mod 4). - John M. Campbell, Jul 07 2016
a(n) = (2/n)*Sum_{k=1..n} A186690(k)*a(n-k), a(0) = 1. - Seiichi Manyama, May 27 2017
a(n) = 2 * A010052(n) if n>0. a(3*n + 1) = 2 * A089801(n). a(3*n + 2) = 0. a(4*n) = a(n). a(4*n + 2) = a(4*n + 3) = 0. a(8*n + 1) = 2 * A010054(n). - Michael Somos, May 11 2019
Dirichlet g.f.: 2*zeta(2s). - Francois Oger, Oct 26 2019 [Corrected by Sean A. Irvine, Nov 26 2024]
G.f. appears to equal exp( 2*Sum_{n >= 0} x^(2*n+1)/((2*n+1)*(1 + x^(2*n+1))) ). - Peter Bala, Dec 23 2021
From Peter Bala, Sep 27 2023: (Start)
G.f. A(x) satisfies A(x)*A(-x) = A(-x^2)^2.
A(x) = Sum_{n >= 1} x^(n-1)*Product_{k >= n} 1 - (-x)^k.
A(x)^2 = 1 + 4*Sum_{n >= 1} (-1)^(n+1)*x^(2*n-1)/(1 - x^(2*n-1)), which gives the number of representations of an integer as a sum of two squares. See, for example, Fine, 26.63.
A(x) = 1 + 2*Sum_{n >= 1} x^(n*(n+1)/2) * ( Product_{k = 1..n-1} 1 + x^k ) /( Product_{k = 1..n} 1 + x^(2*k) ). See Fine, equation 14.43. (End)

A000118 Number of ways of writing n as a sum of 4 squares; also theta series of four-dimensional cubic lattice Z^4.

Original entry on oeis.org

1, 8, 24, 32, 24, 48, 96, 64, 24, 104, 144, 96, 96, 112, 192, 192, 24, 144, 312, 160, 144, 256, 288, 192, 96, 248, 336, 320, 192, 240, 576, 256, 24, 384, 432, 384, 312, 304, 480, 448, 144, 336, 768, 352, 288, 624, 576, 384, 96, 456, 744, 576, 336, 432, 960, 576, 192
Offset: 0

Views

Author

Keywords

Comments

a^2 + b^2 + c^2 + d^2 is one of Ramanujan's 54 universal quaternary quadratic forms. - Michael Somos, Apr 01 2008
a(n) is also the number of quaternions q = a + bi + cj + dk, where a, b, c, d are integers, such that a^2 + b^2 + c^2 + d^2 = n (i.e., so that n is the norm of q). These are Lipschitz integer quaternions. - Rick L. Shepherd, Mar 27 2009
Number 5 and 35 of the 126 eta-quotients listed in Table 1 of Williams 2012. - Michael Somos, Nov 10 2018
This is the convolution square of A004018. - Pierre Abbat, May 15 2023

Examples

			G.f. = 1 + 8*q + 24*q^2 + 32*q^3 + 24*q^4 + 48*q^5 + 96*q^6 + 64*q^7 + 24*q^8 + ...
a(1)=8 counts 1 = 1^2 + 0^2 + 0^2 + 0^2 = 0^2 + 1^2 + 0^2 + 0^2 = 0^2 + 0^2 + 1^2 + 0^2 = 0^2 + 0^2 + 0^2 + 1^2 and 4 more sums where 1^2 is replaced by (-1)^2. - _R. J. Mathar_, May 16 2023
		

References

  • J. H. Conway and R. K. Guy, The Book of Numbers, New York: Springer-Verlag, 1996, ch. 8, pp. 231-2.
  • J. H. Conway and N. J. A. Sloane, Sphere Packing, Lattices and Groups, Springer-Verlag, p. 108, Eq. (49).
  • N. J. Fine, Basic Hypergeometric Series and Applications, Amer. Math. Soc., 1988; p. 78, Eq. (32.28). See also top of p. 94.
  • E. Freitag and R. Busam, Funktionentheorie 1, 4. Auflage, Springer, 2006, p. 392.
  • G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers. 3rd ed., Oxford Univ. Press, 1954, p. 314, Theorem 386.
  • Carlos J. Moreno and Samuel S. Wagstaff, Jr., Sums of Squares of integers, Chapman & Hall/CRC, 2006, p. 29.
  • S. Ramanujan, Collected Papers, Chap. 20, Cambridge Univ. Press 1927 (Proceedings of the Camb. Phil. Soc., 19 (1917) 11-21).

Crossrefs

Row d=4 of A122141 and of A319574, 4th column of A286815.
For number of solutions to a^2+b^2+c^2+k*d^2=n for k=1, 2, 3, 4, 5, 6, 7, 8, 12, see A000118, A236928, A236926, A236923, A236930, A236931, A236932, A236927, A236933.

Programs

  • Haskell
    a000118 0 = 1
    a000118 n = 8 * a046897 n  -- Reinhard Zumkeller, Aug 12 2015
    
  • Julia
    # JacobiTheta3 is defined in A000122.
    A000118List(len) = JacobiTheta3(len, 4)
    A000118List(57) |> println # Peter Luschny, Mar 12 2018
    
  • MATLAB
    a(n) = 8 * sum(find(mod(n,1:n)==0 & mod(1:n,4))) + (n==0) % David Mellinger, Aug 04 2025
  • Magma
    A := Basis( ModularForms( Gamma0(4), 2), 57); A[1] + 8*A[2]; /* Michael Somos, Aug 21 2014 */
    
  • Maple
    (add(q^(m^2),m=-10..10))^4; seq(coeff(%,q,n), n=0..50);
    # Alternative:
    A000118list := proc(len) series(JacobiTheta3(0, x)^4, x, len+1);
    seq(coeff(%, x, j), j=0..len-1) end: A000118list(57); # Peter Luschny, Oct 02 2018
  • Mathematica
    Table[SquaresR[4, n], {n, 0, 46}]
    a[ n_] :=  SeriesCoefficient[ EllipticTheta[ 3, 0, q]^4, {q, 0, n}]; (* Michael Somos, Jun 12 2014 *)
    a[ n_] := If[ n < 1, Boole[ n == 0], 8 Sum[ If[ Mod[ d, 4] > 0, d, 0], {d, Divisors @ n }]]; (* Michael Somos, Feb 20 2015 *)
    QP = QPochhammer; CoefficientList[QP[-q]^8/QP[q^2]^4 + O[q]^60, q] (* Jean-François Alcover, Nov 24 2015 *)
  • PARI
    {a(n) = if( n<1, n==0, 8 * sumdiv( n, d, if( d%4, d)))}; /* Michael Somos, Apr 01 2003 */
    
  • PARI
    {a(n) = local(A); if( n<0, 0, A = x * O(x^n); polcoeff( (eta(x^2 + A)^5 / (eta(x + A)^2 * eta(x^4 + A)^2))^4, n))}; /* Michael Somos, Apr 01 2008 */
    
  • PARI
    q='q+O('q^66); Vec((eta(q^2)^5/(eta(q)^2*eta(q^4)^2))^4) /* Joerg Arndt, Apr 08 2013 */
    
  • PARI
    a(n) = 8*sigma(n) - if (n % 4, 0, 32*sigma(n/4)); \\ Michel Marcus, Jul 13 2016
    
  • Python
    from sympy import divisors
    def a(n): return 1 if n==0 else 8*sum(d for d in divisors(n) if d%4 != 0)
    print([a(n) for n in range(57)]) # Michael S. Branicky, Jan 08 2021
    
  • Python
    from sympy import divisor_sigma
    def A000118(n): return 1 if n == 0 else 8*divisor_sigma(n) if n % 2 else 24*divisor_sigma(int(bin(n)[2:].rstrip('0'),2)) # Chai Wah Wu, Jun 27 2022
    
  • Sage
    A = ModularForms( Gamma0(4), 2, prec=57) . basis(); A[0] + 8*A[1]; # Michael Somos, Jun 12 2014
    
  • Sage
    Q = DiagonalQuadraticForm(ZZ, [1]*4)
    Q.representation_number_list(60) # Peter Luschny, Jun 20 2014
    

Formula

G.f.: theta_3(q)^4 = (Product_{n>=1} (1-q^(2n))*(1+q^(2n-1))^2)^4 = eta(-q)^8/eta(q^2)^4; eta = Dedekind's function.
a(n) = 8*sigma(n) - 32*sigma(n/4) for n > 0, where the latter term is 0 if n is not a multiple of 4.
Euler transform of period 4 sequence [8, -12, 8, -4, ...]. - Michael Somos, Dec 16 2002
G.f. A(x) satisfies 0 = f(A(x), A(x^3), A(x^9)) where f(u, v, w) = v^4 - 30*u*v^2*w + 12*u*v*w*(u + 9*w) - u*w*(u^2 + 9*w*u + 81*w^2). - Michael Somos, Nov 02 2006
G.f. is a period 1 Fourier series which satisfies f(-1/(4*t)) = 4*(t/i)^2*f(t) where q = exp(2*Pi*i*t). - Michael Somos, Jan 25 2008
For n > 0, a(n)/8 is multiplicative and a(p^n)/8 = 1 + p + p^2 + ... + p^n for p an odd prime, a(2^n)/8 = 1 + 2 for n > 0.
a(n) = 8*A000203(n/A006519(n))*(2 + (-1)^n). - Benoit Cloitre, May 16 2002
G.f.: 1 + 8*Sum_{k>0} x^k / (1 + (-x)^k)^2 = 1 + 8*Sum_{k>0} k * x^k / (1 + (-x)^k).
G.f. = s(2)^20/(s(1)*s(4))^8, where s(k) := subs(q=q^k, eta(q)), where eta(q) is Dedekind's function, cf. A010815. [Fine]
Fine gives another explicit formula for a(n) in terms of the divisors of n.
a(n) = 8*A046897(n), n > 0. - Ralf Stephan, Apr 02 2003
A096727(n) = (-1)^n * a(n). a(2*n) = A004011(n). a(2*n + 1) = A005879(n).
Dirichlet g.f.: Sum_{n>=1} a(n)/n^s = 8*(1-4^(1-s))*zeta(s)*zeta(s-1). [Ramanu. J. 7 (2003) 95-127, eq (3.2)]. - R. J. Mathar, Jul 02 2012
Average value is (Pi^2/2)*n + O(sqrt(n)). - Charles R Greathouse IV, Feb 17 2015
From Wolfdieter Lang, Jan 14 2016: (Start)
For n >= 1: a(n) = 8*Sum_{d | n} b(d)*d, with b(d) = 1 if d/4 is not an integer else 0. See, e.g., the Freitag-Busam reference, p. 392.
For n >= 1: a(n) = 8*sigma(n) if n is odd else 24*sigma(m(n)), where m(n) is the largest odd divisor of n (see A000265), and sigma is given in A000203. See the Moreno-Wagstaff reference, Theorem 2. 6 (Jacobi), p. 29. (End)
a(n) = (8/n)*Sum_{k=1..n} A186690(k)*a(n-k), a(0) = 1. - Seiichi Manyama, May 27 2017

A004018 Theta series of square lattice (or number of ways of writing n as a sum of 2 squares). Often denoted by r(n) or r_2(n).

Original entry on oeis.org

1, 4, 4, 0, 4, 8, 0, 0, 4, 4, 8, 0, 0, 8, 0, 0, 4, 8, 4, 0, 8, 0, 0, 0, 0, 12, 8, 0, 0, 8, 0, 0, 4, 0, 8, 0, 4, 8, 0, 0, 8, 8, 0, 0, 0, 8, 0, 0, 0, 4, 12, 0, 8, 8, 0, 0, 0, 0, 8, 0, 0, 8, 0, 0, 4, 16, 0, 0, 8, 0, 0, 0, 4, 8, 8, 0, 0, 0, 0, 0, 8, 4, 8, 0, 0, 16, 0, 0, 0, 8, 8, 0, 0, 0, 0, 0, 0, 8, 4, 0, 12, 8
Offset: 0

Views

Author

Keywords

Comments

Number of points in square lattice on the circle of radius sqrt(n). Equivalently, number of Gaussian integers of norm n (cf. Conway-Sloane, p. 106).
Let b(n)=A004403(n), then Sum_{k=1..n} a(k)*b(n-k) = 1. - John W. Layman
Theta series of D_2 lattice.
Number 6 of the 74 eta-quotients listed in Table I of Martin (1996).
Ramanujan theta functions: f(q) (see A121373), phi(q) (A000122), psi(q) (A010054), chi(q) (A000700).
The zeros in this sequence correspond to those integers with an equal number of 4k+1 and 4k+3 divisors, or equivalently to those that have at least one 4k+3 prime factor with an odd exponent (A022544). - Ant King, Mar 12 2013
If A(q) = 1 + 4*q + 4*q^2 + 4*q^4 + 8*q^5 + ... denotes the o.g.f. of this sequence then the function F(q) := 1/4*(A(q^2) - A(q^4)) = ( Sum_{n >= 0} q^(2*n+1)^2 )^2 is the o.g.f. for counting the ways a positive integer n can be written as the sum of two positive odd squares. - Peter Bala, Dec 13 2013
Expansion coefficients of (2/Pi)*K, with the real quarter period K of elliptic functions, as series of the Jacobi nome q, due to (2/Pi)*K = theta_3(0,q)^2. See, e.g., Whittaker-Watson, p. 486. - Wolfdieter Lang, Jul 15 2016
Sum_{k=0..n} a(n) = A057655(n). Robert G. Wilson v, Dec 22 2016
Limit_{n->oo} (a(n)/n - Pi*log(n)) = A062089: Sierpinski's constant. - Robert G. Wilson v, Dec 22 2016
The mean value of a(n) is Pi, see A057655 for more details. - M. F. Hasler, Mar 20 2017

Examples

			G.f. = 1 + 4*q + 4*q^2 + 4*q^4 + 8*q^5 + 4*q^8 + 4*q^9 + 8*q^10 + 8*q^13 + 4*q^16 + 8*q^17 + 4*q^18 + 8*q^20 + 12*q^25 + 8*q^26 + ... . - _John Cannon_, Dec 30 2006
		

References

  • L. Comtet, Advanced Combinatorics, Reidel, 1974, p. 162, #16 (7), r(n).
  • J. H. Conway and N. J. A. Sloane, "Sphere Packings, Lattices and Groups", Springer-Verlag, p. 106.
  • N. J. Fine, Basic Hypergeometric Series and Applications, Amer. Math. Soc., 1988; p. 78, Eq. (32.23).
  • E. Grosswald, Representations of Integers as Sums of Squares. Springer-Verlag, NY, 1985, p. 15, p. 32, Lemma 2 (with the proof), p. 116, (9.10) first formula.
  • G. H. Hardy, Ramanujan: twelve lectures on subjects suggested by his life and work, Cambridge, University Press, 1940, p. 133.
  • G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers. 3rd ed., Oxford Univ. Press, 1954, p. 240, r(n).
  • W. König and J. Sprekels, Karl Weierstraß (1815-1897), Springer Spektrum, Wiesbaden, 2016, p. 186-187 and p. 280-281.
  • C. D. Olds, A. Lax and G. P. Davidoff, The Geometry of Numbers, Math. Assoc. Amer., 2000, p. 51.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, pages 244-245.
  • E. T. Whittaker and G. N. Watson, A Course of Modern Analysis, fourth edition, reprinted, 1958, Cambridge at the University Press.

Crossrefs

Row d=2 of A122141 and of A319574, 2nd column of A286815.
Partial sums - 1 give A014198.
A071385 gives records; A071383 gives where records occur.

Programs

  • Julia
    # JacobiTheta3 is defined in A000122.
    A004018List(len) = JacobiTheta3(len, 2)
    A004018List(102) |> println # Peter Luschny, Mar 12 2018
    
  • Magma
    Basis( ModularForms( Gamma1(4), 1), 100) [1]; /* Michael Somos, Jun 10 2014 */
    
  • Maple
    (sum(x^(m^2),m=-10..10))^2;
    # Alternative:
    A004018list := proc(len) series(JacobiTheta3(0, x)^2, x, len+1);
    seq(coeff(%, x, j), j=0..len-1) end:
    t1 := A004018list(102);
    r2 := n -> t1[n+1]; # Peter Luschny, Oct 02 2018
  • Mathematica
    SquaresR[2,Range[0,110]] (* Harvey P. Dale, Oct 10 2011 *)
    a[ n_] := SquaresR[ 2, n]; (* Michael Somos, Nov 15 2011 *)
    a[ n_] := SeriesCoefficient[ EllipticTheta[ 3, 0, q]^2, {q, 0, n}]; (* Michael Somos, Nov 15 2011 *)
    a[ n_] := With[{m = InverseEllipticNomeQ @ q}, SeriesCoefficient[ EllipticK[ m] / (Pi/2), {q, 0, n}]]; (* Michael Somos, Jun 10 2014 *)
    a[ n_] := If[ n < 1, Boole[n == 0], 4 Sum[ KroneckerSymbol[-4, d], {d, Divisors@n}]]; (* or *) a[ n_] := SeriesCoefficient[ QPochhammer[ q^2]^10/(QPochhammer[ q] QPochhammer[ q^4])^4, {q, 0, n}]; (* Michael Somos, May 17 2015 *)
  • PARI
    {a(n) = polcoeff( 1 + 4 * sum( k=1, n, x^k / (1 + x^(2*k)), x * O(x^n)), n)}; /* Michael Somos, Mar 14 2003 */
    
  • PARI
    {a(n) = if( n<1, n==0, 4 * sumdiv( n, d, (d%4==1) - (d%4==3)))}; /* Michael Somos, Jul 19 2004 */
    
  • PARI
    {a(n) = if( n<1, n==0, 2 * qfrep([ 1, 0; 0, 1], n)[n])}; /* Michael Somos, May 13 2005 */
    
  • PARI
    a(n)=if(n==0,return(1)); my(f=factor(n)); 4*prod(i=1,#f~, if(f[i,1]%4==1, f[i,2]+1, if(f[i,2]%2 && f[i,1]>2, 0, 1))) \\ Charles R Greathouse IV, Sep 02 2015
    
  • Python
    from sympy import factorint
    def a(n):
        if n == 0: return 1
        an = 4
        for pi, ei in factorint(n).items():
           if pi%4 == 1: an *= ei+1
           elif pi%4 == 3 and ei%2: return 0
        return an
    print([a(n) for n in range(102)]) # Michael S. Branicky, Sep 24 2021
    
  • Python
    from math import prod
    from sympy import factorint
    def A004018(n): return prod(1 if p==2 else (e+1 if p&3==1 else (e+1)&1) for p, e in factorint(n).items())<<2 if n else 1 # Chai Wah Wu, Jul 07 2022, corrected Jun 21 2024.
  • Sage
    Q = DiagonalQuadraticForm(ZZ, [1]*2)
    Q.representation_number_list(102) # Peter Luschny, Jun 20 2014
    

Formula

Expansion of theta_3(q)^2 = (Sum_{n=-oo..+oo} q^(n^2))^2 = Product_{m>=1} (1-q^(2*m))^2 * (1+q^(2*m-1))^4; convolution square of A000122.
Factor n as n = p1^a1 * p2^a2 * ... * q1^b1 * q2^b2 * ... * 2^c, where the p's are primes == 1 (mod 4) and the q's are primes == 3 (mod 4). Then a(n) = 0 if any b is odd, otherwise a(n) = 4*(1 + a1)*(1 + a2)*...
G.f. = s(2)^10/(s(1)^4*s(4)^4), where s(k) := subs(q=q^k, eta(q)) and eta(q) is Dedekind's function, cf. A010815. [Fine]
a(n) = 4*A002654(n), n > 0.
Expansion of eta(q^2)^10 / (eta(q) * eta(q^4))^4 in powers of q. - Michael Somos, Jul 19 2004
Expansion of ( phi(q)^2 + phi(-q)^2 ) / 2 in powers of q^2 where phi() is a Ramanujan theta function.
G.f. A(x) satisfies 0 = f(A(x), A(x^2), A(x^4)) where f(u, v, w) = (u - v)^2 - (v - w) * 4 * w. - Michael Somos, Jul 19 2004
Euler transform of period 4 sequence [4, -6, 4, -2, ...]. - Michael Somos, Jul 19 2004
Moebius transform is period 4 sequence [4, 0, -4, 0, ...]. - Michael Somos, Sep 17 2007
G.f. is a period 1 Fourier series which satisfies f(-1 / (4 t)) = 2 (t/i) f(t) where q = exp(2 Pi i t).
The constant sqrt(Pi)/Gamma(3/4)^2 produces the first 324 terms of the sequence when expanded in base exp(Pi), 450 digits of the constant are necessary. - Simon Plouffe, Mar 03 2011
a(n) = A004531(4*n). a(n) = 2*A105673(n), if n>0.
Let s = 16*q*(E1*E4^2/E2^3)^8 where Ek = Product_{n>=1} (1-q^(k*n)) (s=k^2 where k is elliptic k), then the g.f. is hypergeom([+1/2, +1/2], [+1], s) (expansion of 2/Pi*ellipticK(k) in powers of q). - Joerg Arndt, Aug 15 2011
Dirichlet g.f. Sum_{n>=1} a(n)/n^s = 4*zeta(s)*L_(-4)(s), where L is the D.g.f. of the (shifted) A056594. [Raman. J. 7 (2003) 95-127]. - R. J. Mathar, Jul 02 2012
a(n) = floor(1/(n+1)) + 4*floor(cos(Pi*sqrt(n))^2) - 4*floor(cos(Pi*sqrt(n/2))^2) + 8*Sum_{i=1..floor(n/2)} floor(cos(Pi*sqrt(i))^2)*floor(cos(Pi*sqrt(n-i))^2). - Wesley Ivan Hurt, Jan 09 2013
From Wolfdieter Lang, Aug 01 2016: (Start)
A Jacobi identity: theta_3(0, q)^2 = 1 + 4*Sum_{r>=0} (-1)^r*q^(2*r+1)/(1 - q^(2*r+1)). See, e.g., the Grosswald reference (p. 15, p. 116, but p. 32, Lemma 2 with the proof, has the typo r >= 1 instead of r >= 0 in the sum, also in the proof). See the link with the Jacobi-Legendre letter.
Identity used by Weierstraß (see the König-Sprekels book, p. 187, eq. (5.12) and p. 281, with references, but there F(x) from (5.11) on p. 186 should start with nu =1 not 0): theta_3(0, q)^2 = 1 + 4*Sum_{n>=1} q^n/(1 + q^(2*n)). Proof: similar to the one of the preceding Jacobi identity. (End)
a(n) = (4/n)*Sum_{k=1..n} A186690(k)*a(n-k), a(0) = 1. - Seiichi Manyama, May 27 2017
G.f.: Theta_3(q)^2 = hypergeometric([1/2, 1/2],[1],lambda(q)), with lambda(q) = Sum_{j>=1} A115977(j)*q^j. See the Kontsevich and Zagier link, with Theta -> Theta_3, z -> 2*z and q -> q^2. - Wolfdieter Lang, May 27 2018

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

A064987 a(n) = n*sigma(n).

Original entry on oeis.org

1, 6, 12, 28, 30, 72, 56, 120, 117, 180, 132, 336, 182, 336, 360, 496, 306, 702, 380, 840, 672, 792, 552, 1440, 775, 1092, 1080, 1568, 870, 2160, 992, 2016, 1584, 1836, 1680, 3276, 1406, 2280, 2184, 3600, 1722, 4032, 1892, 3696, 3510, 3312, 2256, 5952
Offset: 1

Views

Author

Vladeta Jovovic, Oct 30 2001

Keywords

Comments

Dirichlet convolution of sigma_2(n)=A001157(n) with phi(n)=A000010(n). - Vladeta Jovovic, Oct 27 2002
Equals row sums of triangle A143311 and of triangle A143308. - Gary W. Adamson, Aug 06 2008
a(n) is also the sum of all n's present in A244580, or in other words, a(n) is also the volume (or number of cubes) below the terraces of the n-th level of the staircase described in A244580 (see also A237593). - Omar E. Pol, Oct 11 2018
If n is a superperfect number then sigma(n) is a Mersenne prime and a(n) is a perfect number, a(A019279(k)) = A000396(k), k >= 1, assuming there are no odd perfect numbers. - Omar E. Pol, Apr 15 2020

References

  • B. C. Berndt, Ramanujan's theory of theta-functions, Theta functions: from the classical to the modern, Amer. Math. Soc., Providence, RI, 1993, pp. 1-63. MR 94m:11054. see page 43.
  • G. H. Hardy, Ramanujan: twelve lectures on subjects suggested by his life and work, AMS Chelsea Publishing, Providence, Rhode Island, 2002, pp. 166-167.

Crossrefs

Main diagonal of A319073.
Cf. A000203, A038040, A002618, A000010, A001157, A143308, A143311, A004009, A006352, A000594, A126832, A069097 (Mobius transform), A001001 (inverse Mobius transform), A237593, A244580.

Programs

  • GAP
    a:=List([1..50],n->n*Sigma(n));; Print(a); # Muniru A Asiru, Jan 01 2019
  • Haskell
    a064987 n = a000203 n * n  -- Reinhard Zumkeller, Jan 21 2014
    
  • Magma
    [n*SumOfDivisors(n): n in [1..70]]; // Vincenzo Librandi, Jan 01 2019
    
  • Maple
    with(numtheory): [n*sigma(n)$n=1..50]; # Muniru A Asiru, Jan 01 2019
  • Mathematica
    # DivisorSigma[1,#]&/@Range[80]  (* Harvey P. Dale, Mar 12 2011 *)
  • MuPAD
    numlib::sigma(n)*n$ n=1..81 // Zerinvary Lajos, May 13 2008
    
  • PARI
    {a(n) = if ( n==0, 0, n * sigma(n))}
    
  • PARI
    { for (n=1, 1000, write("b064987.txt", n, " ", n*sigma(n)) ) } \\ Harry J. Smith, Oct 02 2009
    

Formula

Multiplicative with a(p^e) = p^e * (p^(e+1) - 1) / (p - 1).
G.f.: Sum_{n>0} n^2*x^n/(1-x^n)^2. - Vladeta Jovovic, Oct 27 2002
G.f.: phi_{2, 1}(x) where phi_{r, s}(x) = Sum_{n, m>0} m^r * n^s * x^{m*n}. - Michael Somos, Apr 02 2003
G.f. is also (Q - P^2) / 288 where P, Q are Ramanujan Lambert series. - Michael Somos, Apr 02 2003. See the Hardy reference, p. 136, eq. (10.5.4) (with a proof). For Q and P, (10.5.6) and (10.5.5), see E_4 A004009 and E_2 A006352, respectively. - Wolfdieter Lang, Jan 30 2017
Convolution of A000118 and A186690. Dirichlet convolution of A000027 and A000290. - Michael Somos, Mar 25 2012
Dirichlet g.f.: zeta(s-1)*zeta(s-2). - R. J. Mathar, Feb 16 2011
a(n) = A009194(n)*A009242(n). - Michel Marcus, Oct 23 2013
a(n) (mod 5) = A126832(n) = A000594(n) (mod 5). See A126832 for references. - Wolfdieter Lang, Feb 03 2017
L.g.f.: Sum_{k>=1} k*x^k/(1 - x^k) = Sum_{n>=1} a(n)*x^n/n. - Ilya Gutkovskiy, May 13 2017
Sum_{k>=1} 1/a(k) = 1.4383899259334187832765458631783591251241657856627653748389234270650138768... - Vaclav Kotesovec, Sep 20 2020
From Peter Bala, Jan 21 2021: (Start)
G.f.: Sum_{n >= 1} n*q^n*(1 + q^n)/(1 - q^n)^3 (use the expansion x*(1 + x)/(1 - x)^3 = x + 2^2*x^2 + 3^2*x^3 + 4^2*x^4 + ...).
A faster converging g.f.: Sum_{n >= 1} q^(n^2)*( n^3*q^(3*n) - (n^3 + 3*n^2 - n)*q^(2*n) - (n^3 - 3*n^2 - n)*q^n + n^3 )/(1 - q^n)^3 - differentiate equation 5 in Arndt w.r.t. both x and q and then set x = 1. (End)
From Richard L. Ollerton, May 07 2021: (Start)
a(n) = Sum_{k=1..n} sigma_2(gcd(n,k)).
a(n) = Sum_{k=1..n} sigma_2(n/gcd(n,k))*phi(gcd(n,k))/phi(n/gcd(n,k)). (End)
From Peter Bala, Jan 22 2024: (Start)
a(n) = Sum_{1 <= j, k <= n} sigma_1( gcd(j, k, n) ).
a(n) = Sum_{d divides n} sigma_1(d)*J_2(n/d) = Sum_{d divides n} sigma_2(d)* phi(n/d), where the Jordan totient function J_2(n) = A007434(n). (End)

A000143 Number of ways of writing n as a sum of 8 squares.

Original entry on oeis.org

1, 16, 112, 448, 1136, 2016, 3136, 5504, 9328, 12112, 14112, 21312, 31808, 35168, 38528, 56448, 74864, 78624, 84784, 109760, 143136, 154112, 149184, 194688, 261184, 252016, 246176, 327040, 390784, 390240, 395136, 476672, 599152, 596736, 550368, 693504, 859952
Offset: 0

Views

Author

Keywords

Comments

The relevant identity for the o.g.f. is theta_3(x)^8 = 1 + 16*Sum_{j >= 1} j^3*x^j/(1 - (-1)^j*x^j). See the Hardy-Wright reference, p. 315. - Wolfdieter Lang, Dec 08 2016

Examples

			1 + 16*q + 112*q^2 + 448*q^3 + 1136*q^4 + 2016*q^5 + 3136*q^6 + 5504*q^7 + ...
		

References

  • N. J. Fine, Basic Hypergeometric Series and Applications, Amer. Math. Soc., 1988; p. 77, Eq. (31.61); p. 79 Eq. (32.32).
  • E. Grosswald, Representations of Integers as Sums of Squares. Springer-Verlag, NY, 1985, p. 121.
  • G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers. 3rd ed., Oxford Univ. Press, 1954, pp. 314 - 315.

Crossrefs

8th column of A286815. - Seiichi Manyama, May 27 2017
Row d=8 of A122141.
Ramanujan theta functions: f(q) (see A121373), phi(q) (A000122), psi(q) (A010054), chi(q) (A000700).
Cf. A004018, A000118, A000141 for the expansion of the powers of 2, 4, 6 of theta_3(x).

Programs

  • Julia
    # JacobiTheta3 is defined in A000122.
    A000143List(len) = JacobiTheta3(len, 8)
    A000143List(37) |> println # Peter Luschny, Mar 12 2018
    
  • Maple
    (sum(x^(m^2),m=-10..10))^8;
    with(numtheory); rJ := n-> if n=0 then 1 else 16*add((-1)^(n+d)*d^3, d in divisors(n)); fi; [seq(rJ(n),n=0..100)]; # N. J. A. Sloane, Sep 15 2018
  • Mathematica
    Table[SquaresR[8, n], {n, 0, 33}] (* Ray Chandler, Dec 06 2006 *)
    SquaresR[8,Range[0,50]] (* Harvey P. Dale, Aug 26 2011 *)
    QP = QPochhammer; s = (QP[q^2]^5/(QP[q]*QP[q^4])^2)^8 + O[q]^40; CoefficientList[s, q] (* Jean-François Alcover, Dec 01 2015, adapted from PARI *)
  • PARI
    {a(n) = if( n<1, n==0, 16 * (-1)^n * sumdiv( n, d, (-1)^d * d^3))}
    
  • PARI
    {a(n) = local(A); if( n<0, 0, A = x * O(x^n); polcoeff( (eta(x^2 + A)^5 / (eta(x + A) * eta(x^4 + A))^2)^8, n))} /* Michael Somos, Sep 25 2005 */
    
  • Python
    from math import prod
    from sympy import factorint
    def A000143(n): return prod((p**(3*(e+1))-(1 if p&1 else 15))//(p**3-1) for p, e in factorint(n).items())<<4 if n else 1 # Chai Wah Wu, Jun 21 2024
  • SageMath
    Q = DiagonalQuadraticForm(ZZ, [1]*8)
    Q.representation_number_list(60) # Peter Luschny, Jun 20 2014
    

Formula

Expansion of theta_3(z)^8. Also a(n)=16*(-1)^n*Sum_{0
Expansion of phi(q)^8 in powers of q where phi() is a Ramanujan theta function. - Michael Somos, Mar 21 2008
Expansion of (eta(q^2)^5 / (eta(q) * eta(q^4))^2)^8 in powers of q. - Michael Somos, Sep 25 2005
G.f.: s(2)^40/(s(1)*s(4))^16, where s(k) := subs(q=q^k, eta(q)) and eta(q) is Dedekind's function, cf. A010815. [Fine]
Euler transform of period 4 sequence [16, -24, 16, -8, ...]. - Michael Somos, Apr 10 2005
a(n) = 16 * b(n) and b(n) is multiplicative with b(p^e) = (p^(3*e+3) - 1) / (p^3 - 1) -2[p<3]. - Michael Somos, Sep 25 2005
G.f.: 1 + 16 * Sum_{k>0} k^3 * x^k / (1 - (-x)^k). - Michael Somos, Sep 25 2005
A035016(n) = (-1)^n * a(n). 16 * A008457(n) = a(n) unless n=0.
Dirichlet g.f.: Sum_{n>=1} a(n)/n^s = 16*(1 - 2^(1-s) + 4^(2-s))*zeta(s)*zeta(s-3). [Borwein and Choi], R. J. Mathar, Jul 02 2012
a(n) = (16/n)*Sum_{k=1..n} A186690(k)*a(n-k), a(0) = 1. - Seiichi Manyama, May 27 2017
Sum_{k=1..n} a(k) ~ Pi^4 * n^4 /24. - Vaclav Kotesovec, Jul 12 2024

A000141 Number of ways of writing n as a sum of 6 squares.

Original entry on oeis.org

1, 12, 60, 160, 252, 312, 544, 960, 1020, 876, 1560, 2400, 2080, 2040, 3264, 4160, 4092, 3480, 4380, 7200, 6552, 4608, 8160, 10560, 8224, 7812, 10200, 13120, 12480, 10104, 14144, 19200, 16380, 11520, 17400, 24960, 18396, 16440, 24480, 27200
Offset: 0

Keywords

Comments

The relevant identity for the o.g.f. is theta_3(x)^6 = 1 + 16*Sum_{j>=1} j^2*x^j/(1 + x^(2*j)) - 4*Sum_{j >=0} (-1)^j*(2*j+1)^2 *x^(2*j+1)/(1 - x^(2*j+1)), See the Hardy-Wright reference, p. 315, first equation. - Wolfdieter Lang, Dec 08 2016

References

  • E. Grosswald, Representations of Integers as Sums of Squares. Springer-Verlag, NY, 1985, p. 121.
  • G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers. 3rd ed., Oxford Univ. Press, 1954, p. 314.

Crossrefs

Row d=6 of A122141 and of A319574, 6th column of A286815.

Programs

  • Haskell
    a000141 0 = 1
    a000141 n = 16 * a050470 n - 4 * a002173 n
    -- Reinhard Zumkeller, Jun 17 2013
    
  • Maple
    (sum(x^(m^2),m=-10..10))^6;
    # Alternative:
    A000141list := proc(len) series(JacobiTheta3(0, x)^6, x, len+1);
    seq(coeff(%, x, j), j=0..len-1) end: A000141list(40); # Peter Luschny, Oct 02 2018
  • Mathematica
    Table[SquaresR[6, n], {n, 0, 40}] (* Ray Chandler, Dec 06 2006 *)
    SquaresR[6,Range[0,50]] (* Harvey P. Dale, Aug 26 2011 *)
    EllipticTheta[3, 0, z]^6 + O[z]^40 // CoefficientList[#, z]& (* Jean-François Alcover, Dec 05 2019 *)
  • Python
    from math import prod
    from sympy import factorint
    def A000141(n):
        if n == 0: return 1
        f = [(p,e,(0,1,0,-1)[p&3]) for p,e in factorint(n).items()]
        return (prod((p**(e+1<<1)-c)//(p**2-c) for p, e, c in f)<<2)-prod(((k:=p**2*c)**(e+1)-1)//(k-1) for p, e, c in f)<<2 # Chai Wah Wu, Jun 21 2024
  • Sage
    Q = DiagonalQuadraticForm(ZZ, [1]*6)
    Q.representation_number_list(40) # Peter Luschny, Jun 20 2014
    

Formula

Expansion of theta_3(z)^6.
a(n) = 4( Sum_{ d|n, d ==3 mod 4} d^2 - Sum_{ d|n, d ==1 mod 4} d^2 ) + 16( Sum_{ d|n, n/d ==1 mod 4} d^2 - Sum_{ d|n, n/d ==3 mod 4} d^2 ) [Jacobi]. [corrected by Sean A. Irvine, Oct 01 2009]
a(n) = 16*A050470(n) - 4*A002173(n). - Michel Marcus, Dec 15 2012
a(n) = (12/n)*Sum_{k=1..n} A186690(k)*a(n-k), a(0) = 1. - Seiichi Manyama, May 27 2017

Extensions

Extended by Ray Chandler, Nov 28 2006

A008451 Number of ways of writing n as a sum of 7 squares.

Original entry on oeis.org

1, 14, 84, 280, 574, 840, 1288, 2368, 3444, 3542, 4424, 7560, 9240, 8456, 11088, 16576, 18494, 17808, 19740, 27720, 34440, 29456, 31304, 49728, 52808, 43414, 52248, 68320, 74048, 68376, 71120, 99456, 110964, 89936, 94864, 136080, 145222
Offset: 0

Keywords

References

  • E. Grosswald, Representations of Integers as Sums of Squares. Springer-Verlag, NY, 1985, p. 121.
  • G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers. 3rd ed., Oxford Univ. Press, 1954, p. 314.

Crossrefs

Row d=7 of A122141 and of A319574, 7th column of A286815.

Programs

  • Maple
    series((sum(x^(m^2),m=-10..10))^7, x, 101);
    # Alternative
    #(requires at least Maple 17, and only works as long as a(n) <= 10^16 or so):
    N:= 1000: # to get a(0) to a(N)
    with(SignalProcessing):
    A:= Vector(N+1,datatype=float[8],i-> piecewise(i=1,1,issqr(i-1),2,0)):
    A2:= Convolution(A,A)[1..N+1]:
    A4:= Convolution(A2,A2)[1..N+1]:
    A5:= Convolution(A,A4)[1..N+1];
    A7:= Convolution(A2,A5)[1..N+1];
    map(round,convert(A7,list)); # Robert Israel, Jul 16 2014
    # Alternative
    A008451list := proc(len) series(JacobiTheta3(0, x)^7, x, len+1);
    seq(coeff(%,x,j), j=0..len-1) end: A008451list(37); # Peter Luschny, Oct 02 2018
  • Mathematica
    Table[SquaresR[7, n], {n, 0, 36}] (* Ray Chandler, Nov 28 2006 *)
    SquaresR[7,Range[0,50]] (* Harvey P. Dale, Aug 26 2011 *)
  • Python
    # uses Python code from A000141
    from math import isqrt
    def A008451(n): return A000141(n)+(sum(A000141(n-k**2) for k in range(1,isqrt(n)+1))<<1) # Chai Wah Wu, Jun 23 2024
  • Sage
    Q = DiagonalQuadraticForm(ZZ, [1]*7)
    Q.representation_number_list(37) # Peter Luschny, Jun 20 2014
    

Formula

G.f.: theta_3(0,x)^7, where theta_3 is the third Jacobi theta function. - Robert Israel, Jul 16 2014
a(n) = (14/n)*Sum_{k=1..n} A186690(k)*a(n-k), a(0) = 1. - Seiichi Manyama, May 27 2017

Extensions

Extended by Ray Chandler, Nov 28 2006

A000132 Number of ways of writing n as a sum of 5 squares.

Original entry on oeis.org

1, 10, 40, 80, 90, 112, 240, 320, 200, 250, 560, 560, 400, 560, 800, 960, 730, 480, 1240, 1520, 752, 1120, 1840, 1600, 1200, 1210, 2000, 2240, 1600, 1680, 2720, 3200, 1480, 1440, 3680, 3040, 2250, 2800, 3280, 4160, 2800, 1920, 4320, 5040, 2800, 3472, 5920
Offset: 0

Keywords

Comments

The units digit of a(n) is 2 if n=5*t^2 for some natural number t, and 0 otherwise. See Moreno & Wagstaff, p. 258, exercise 2. - Ant King, Mar 17 2013
See A025429 for the number of partitions of n into five nonzero squares. - M. F. Hasler, May 30 2014
Also, theta series of lattice Z^5. - Sean A. Irvine, Jul 27 2020

Examples

			G.f. = 1 + 10*x + 40*x^2 + 80*x^3 + 90*x^4 + 112*x^5 + 240*x^6 + ...
		

References

  • E. Grosswald, Representations of Integers as Sums of Squares. Springer-Verlag, NY, 1985, p. 128.
  • J. Carlos Moreno and Samuel S. Wagstaff Jr., Sums Of Squares Of Integers, Chapman & Hall/CRC, (2006). [Ant King, Mar 17 2013]

Crossrefs

5th column of A286815. - Seiichi Manyama, May 27 2017
Row d=5 of A122141.

Programs

  • Mathematica
    Table[SquaresR[5, n], {n, 0, 46}] (* Ray Chandler, Nov 28 2006 *)
    SquaresR[5,Range[0,50]] (* Harvey P. Dale, Aug 26 2011 *)
  • PARI
    a(n, k=5) = if(n==0, return(1)); if(k <= 0, return(0)); if(k==1, return(issquare(n))); my(count = 0); for(v = 0, sqrtint(n), count += (2 - (v == 0))*if(k > 2, a(n - v^2, k-1), issquare(n - v^2) * (2 - (n - v^2 == 0)))); count; \\ Daniel Suteu, Aug 28 2021
    
  • Python
    # uses Python code from A000118
    from math import isqrt
    def A000132(n): return A000118(n)+(sum(A000118(n-k**2) for k in range(1,isqrt(n)+1))<<1) # Chai Wah Wu, Jun 23 2024
  • Sage
    Q = DiagonalQuadraticForm(ZZ, [1]*5)
    Q.representation_number_list(47) # Peter Luschny, Jun 20 2014
    

Formula

G.f.: (Sum_{j=-oo..+oo} x^(j^2))^5. - R. J. Mathar, Jul 31 2007
a(n) = (10/n)*Sum_{k=1..n} A186690(k)*a(n-k), a(0) = 1. - Seiichi Manyama, May 27 2017
a(n) = A000118(n) + 2*Sum_{k=1..floor(sqrt(n))} A000118(n - k^2). - Daniel Suteu, Aug 28 2021

Extensions

Extended by Ray Chandler, Nov 28 2006

A000152 Number of ways of writing n as a sum of 16 squares.

Original entry on oeis.org

1, 32, 480, 4480, 29152, 140736, 525952, 1580800, 3994080, 8945824, 18626112, 36714624, 67978880, 118156480, 197120256, 321692928, 509145568, 772845120, 1143441760, 1681379200, 2428524096, 3392205824, 4658843520, 6411152640
Offset: 0

Keywords

References

  • G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers. 3rd ed., Oxford Univ. Press, 1954, p. 314.
  • E. Grosswald, Representations of Integers as Sums of Squares. Springer-Verlag, NY, 1985, p. 107.

Crossrefs

Row d=16 of A122141 and of A319574, 16th column of A286815.
Cf. A022047(n) = A000152(2*n).

Programs

  • Maple
    (sum(x^(m^2),m=-10..10))^16;
    # Alternative:
    A000152list := proc(len) series(JacobiTheta3(0, x)^16, x, len+1);
    seq(coeff(%, x, j), j=0..len-1) end: A000152list(24); # Peter Luschny, Oct 02 2018
  • Mathematica
    Table[SquaresR[16, n], {n, 0, 23}] (* Ray Chandler, Nov 28 2006 *)
    CoefficientList[EllipticTheta[3, 0, x]^16 + O[x]^24, x] (* Jean-François Alcover, Jul 06 2017 *)
  • PARI
    first(n)=my(x='x); x+=O(x^(n+1)); Vec((2*sum(k=1,sqrtint(n),x^k^2) + 1)^16) \\ Charles R Greathouse IV, Jul 29 2016

Formula

G.f.: theta_3(0,q)^16, where theta_3 is the 3rd Jacobi theta function. - Ilya Gutkovskiy, Jan 13 2017
a(n) = (32/n)*Sum_{k=1..n} A186690(k)*a(n-k), a(0) = 1. - Seiichi Manyama, May 27 2017

Extensions

Extended by Ray Chandler, Nov 28 2006
Showing 1-10 of 25 results. Next