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.

A094572 Number of pairs of integers x, y (of either sign) with x^2 - y^2 = n.

Original entry on oeis.org

2, 0, 4, 2, 4, 0, 4, 4, 6, 0, 4, 4, 4, 0, 8, 6, 4, 0, 4, 4, 8, 0, 4, 8, 6, 0, 8, 4, 4, 0, 4, 8, 8, 0, 8, 6, 4, 0, 8, 8, 4, 0, 4, 4, 12, 0, 4, 12, 6, 0, 8, 4, 4, 0, 8, 8, 8, 0, 4, 8, 4, 0, 12, 10, 8, 0, 4, 4, 8, 0, 4, 12, 4, 0, 12, 4, 8, 0, 4, 12, 10, 0, 4, 8, 8, 0, 8, 8, 4, 0, 8, 4, 8, 0, 8, 16, 4, 0, 12, 6
Offset: 1

Views

Author

N. J. A. Sloane, Nov 02 2008

Keywords

Comments

The old entry with this sequence number was a duplicate of A058071.
a(n) == 2 (mod 4) if n is a square otherwise a(n) is divisible by 4. Cf. A112329. - Peter Bala, Jan 08 2025

References

  • M. N. Huxley, Area, Lattice Points and Exponential Sums, Oxford, 1996; p. 236.

Crossrefs

Programs

  • Maple
    with(numtheory); f:=proc(n) if n mod 2 = 1 then RETURN(2*tau(n)); fi; if n mod 4 = 0 then RETURN(2*tau(n/4)); fi; 0; end;
  • Mathematica
    Table[If[OddQ[n],2DivisorSigma[0,n],If[OddQ[n/2],0,2DivisorSigma[0,n/4]]],{n,100}] (* Ray Chandler, Aug 23 2014 *)
  • PARI
    a(n) = if(n%2, 2 * numdiv(n), if(n % 4 == 0, 2 * numdiv(n/4), 0)); \\ Amiram Eldar, Apr 13 2024

Formula

a(n) = 2*d(n) if n is odd, = 2*d(n/4) if n == 0 mod 4, otherwise 0, where d() = A000005().
a(n) = 2 * A112329(n). - Ray Chandler, Aug 23 2014
From Amiram Eldar, Apr 13 2024: (Start)
Dirichlet g.f.: 2*zeta(s)^2*(1 + 2^(1-2*s) - 2^(1-s)).
Sum_{k=1..n} a(k) ~ n*log(n) + (2*gamma-1)*n, where gamma is Euler's constant (A001620). (End)