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.

A113406 Half the number of integer solutions to x^2 + 4 * y^2 = n.

Original entry on oeis.org

1, 0, 0, 2, 2, 0, 0, 2, 1, 0, 0, 0, 2, 0, 0, 2, 2, 0, 0, 4, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 2, 0, 0, 0, 2, 2, 0, 0, 4, 2, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 4, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 2, 4, 0, 0, 4, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 4, 1, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 6, 2, 0, 0, 4, 0
Offset: 1

Views

Author

Michael Somos, Oct 28 2005

Keywords

Examples

			x + 2*x^4 + 2*x^5 + 2*x^8 + x^9 + 2*x^13 + 2*x^16 + 2*x^17 + 4*x^20 + ...
		

References

  • B. C. Berndt, Ramanujan's Notebooks Part V, Springer-Verlag, see p. 373 Entry 32.
  • J. H. Conway and N. J. A. Sloane, "Sphere Packings, Lattices and Groups", Springer-Verlag, p. 120.

Crossrefs

Programs

  • Mathematica
    s = (EllipticTheta[3, 0, q]*EllipticTheta[3, 0, q^4] - 1)/(2 q) + O[q]^105; CoefficientList[s, q] (* Jean-François Alcover, Dec 02 2015 *)
  • PARI
    {a(n) = if( n<1, 0, qfrep( [1, 0; 0, 4], n)[n])}
    
  • PARI
    {a(n) = if( n<1, 0, if( n%4==1, sumdiv( n, d, (-1)^(d\2)), if( n%4==0, 2 * sumdiv( n, d, kronecker( -4, d)))))}
    
  • PARI
    {a(n) = local(A, p, e); if( n<1, 0, A = factor(n); prod( k=1, matsize(A)[1], if( p = A[k,1], e = A[k,2]; if( p==2, 2 * (e>1), if( p%4==3, (1 + (-1)^e) / 2, e+1)))))}

Formula

a(n) is multiplicative with a(2) = 0, a(2^e) = 2 if e>1, a(p^e) = e+1 if p == 1 (mod 4), a(p^e) = (1 + (-1)^e)/2 if p == 3 (mod 4)
G.f.: (theta_3(q) * theta_3(q^4) - 1) / 2.
a(4*n + 2) = a(4*n + 3) = 0. A004531(n) = 2 * a(n) if n>0. a(4*n + 1) = A008441(n). A004018(n) = 2 * a(4*n) if n>0.
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = Pi/4 = 0.785398... (A003881). - Amiram Eldar, Oct 15 2022