A112329 Number of divisors of n if n odd, number of divisors of n/4 if n divisible by 4, otherwise 0.
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
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.
Links
- Ray Chandler, Table of n, a(n) for n = 1..10000
- M. Kühleitner, An Omega Theorem on Differences of Two Squares, Acta Mathematica Universitatis Comenianae, Vol. 61, 1 (1992) pp. 117-123. See Lemma 1 p. 2.
- John Shareshian and Sheila Sundaram, Ramanujan sums and rectangular power sums, arXiv:2305.12007 [math.CO], 2023. Mentions this sequence.
- N. J. A. Sloane et al., Binary Quadratic Forms and OEIS (Index to related sequences, programs, references)
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
Comments