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.

A112329 Number of divisors of n if n odd, number of divisors of n/4 if n divisible by 4, otherwise 0.

Original entry on oeis.org

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

Views

Author

Michael Somos, Sep 04 2005

Keywords

Comments

First occurrence of k: 2, 1, 3, 9, 15, 64, 45, 256, 96, 144, 192, 4096, 240, ????, 768, 576, 480, ????, 720, ..., . See A246063. - Robert G. Wilson v, Oct 31 2013
a(n) is the number of pairs (u, v) in NxZ satisfying u^2-v^2=n. See Kühleitner. - Michel Marcus, Jul 30 2017
The g.f. in the form Sum_{k >= 1} x^(k^2) * (1 + x^(2*k))/(1 - x^(2*k)) = Sum_{k >= 1} x^(k^2) * (1 + x^(2*k))/(1 + x^(2*k) - 2*x^(2*k)) == Sum_{k >= 1} x^(k^2) (mod 2). It follows that a(n) is odd iff n = k^2 for some positive integer k. - Peter Bala, Jan 08 2025

Examples

			x + 2*x^3 + x^4 + 2*x^5 + 2*x^7 + 2*x^8 + 3*x^9 + 2*x^11 + 2*x^12 + ...
		

References

  • G. H. Hardy, Ramanujan: twelve lectures on subjects suggested by his life and work, AMS Chelsea Publishing, Providence, Rhode Island, 2002, p. 142.

Crossrefs

Programs

  • Maple
    f:= proc(n) if n::odd then numtheory:-tau(n) elif n mod 4 = 0 then numtheory:-tau(n/4) else 0 fi end proc;
    seq(f(i),i=1..100); # Robert Israel, Aug 24 2014
  • Mathematica
    Rest[ CoefficientList[ Series[ Sum[x^k/(1 - (-x)^k), {k, 111}], {x, 0, 110}], x]] (* Robert G. Wilson v, Sep 20 2005 *)
    Table[If[OddQ[n],DivisorSigma[0,n],If[OddQ[n/2],0,DivisorSigma[0,n/4]]],{n,100} ] (* Ray Chandler, Aug 23 2014 *)
  • PARI
    {a(n) = if( n<1, 0, (-1)^n * sumdiv( n, d, (-1)^d))}
    
  • PARI
    {a(n) = if( n<1, 0, if( n%2, numdiv(n), if( n%4, 0, numdiv(n/4))))} /* Michael Somos, Sep 02 2006 */
    
  • PARI
    d(n) = if (denominator(n)==1, numdiv(n), 0);
    a(n) = numdiv(n) - 2*d(n/2) + 2*d(n/4); \\ Michel Marcus, Jul 30 2017

Formula

Multiplicative with a(2^e) = e-1 if e>0, a(p^e) = 1+e if p>2.
G.f.: Sum_{k>0} x^k / (1 - (-x)^k) = Sum_{k>0} -(-x)^k / (1 + (-x)^k).
Möbius transform is period 4 sequence [ 1, -1, 1, 1, ...].
G.f.: Sum_{k>=1} x^(k^2) * (1+x^(2*k))/(1-x^(2*k)). - Joerg Arndt, Nov 08 2010
a(4*n + 2) = 0. a(n) = -(-1)^n * A048272(n). a(2*n - 1) = A099774(n). a(4*n) = A000005(n). a(4*n + 1) = A000005(4*n + 1). a(4*n - 1) = 2 * A078703(n).
a(n) = A094572(n) / 2. - Ray Chandler, Aug 23 2014
Bisection: a(2*k-1) = A000005(2*k-1), a(2*k) = A183063(2*k) - A001227(2*k), k >= 1. See the Hardy reference, p. 142 where a(n) = sigma^*0(n). - _Wolfdieter Lang, Jan 07 2017
a(n) = d(n) - 2*d(n/2) + 2*d(n/4) where d(n) = 0 if n is not an integer. See Kühleitner.
a(n) = Sum_{d|n} [(d mod 2) = (n/d mod 2)], where [ ] is the Iverson bracket. - Wesley Ivan Hurt, Mar 21 2022
From Amiram Eldar, Nov 29 2022: (Start)
Dirichlet g.f.: zeta(s)^2*(1 + 2^(1-2*s) - 2^(1-s)).
Sum_{k=1..n} a(k) ~ n*log(n)/2 + (2*gamma-1)*n/2, where gamma is Euler's constant (A001620). (End)
a(n) = (-1)^n * Sum_{d|2*n} cos(d*Pi/2). - Ridouane Oudra, Sep 27 2024