login
Sum of odd divisors of n times (-1)^(n+1).
5

%I #43 Nov 12 2022 05:25:02

%S 1,-1,4,-1,6,-4,8,-1,13,-6,12,-4,14,-8,24,-1,18,-13,20,-6,32,-12,24,

%T -4,31,-14,40,-8,30,-24,32,-1,48,-18,48,-13,38,-20,56,-6,42,-32,44,

%U -12,78,-24,48,-4,57,-31,72,-14,54,-40,72,-8,80,-30,60,-24,62,-32,104,-1,84,-48,68,-18,96,-48,72,-13,74,-38,124

%N Sum of odd divisors of n times (-1)^(n+1).

%D C. G. J. Jacobi, Gesammelte Werke, Vol. 2, 1969, Chelsea, NY, p. 179, eq (6.).

%H Alois P. Heinz, <a href="/A115607/b115607.txt">Table of n, a(n) for n = 1..20000</a>

%F Moebius transform is [ 1, -2, 3, 0, 5, -6, 7, 0, 9, -10, 11, 0, ...].

%F a(n) is multiplicative with a(2^e) = -1 if e > 0, a(p^e) = (p^(e+1) - 1) / (p-1) if p > 2.

%F G.f.: (theta_2(q)^4 - theta_4(q)^4 + 1) / 24.

%F G.f.: Sum_{k>0} - k * (-x)^k / (1 + (-x)^k) = Sum_{k>0} x^k / (1 - (-x)^k)^2.

%F G.f.: Sum_{k>0} (2*k - 1) * x^(2*k - 1) / (1 + x^(2*k - 1)) = Sum_{k>0} x^k / (1 - x^k)^2 - 4 * x^(4*k - 2) / (1 - x^(4*k - 2))^2.

%F Empirical: Sum_{n>=1} exp(-Pi)^n*a(n) = 1/24. - _Simon Plouffe_, Feb 20 2011

%F Dirichlet g.f. (1-2^(1-s))^2*zeta(s)*zeta(s-1). - _R. J. Mathar_, Apr 06 2011

%F a(n) = -(-1)^n * A000593(n). -24 * a(n) = A103640(n) if n > 0.

%F G.f.: Sum_{k>0} -(-1)^k * x^k * (1 + x^(2*k)) / (1 - x^(2*k))^2. - _Michael Somos_, Jun 26 2012

%F L.g.f.: -log(Product_{ k>0 } (1+(-x)^k)) = Sum_{ n>=0 } (a(n)/n)*x^n. - _Benedict W. J. Irwin_, Jul 04 2016

%F Sum_{k=1..n} a(k) ~ c * n^2, where c = Pi^2/48 = 0.205616... . - _Amiram Eldar_, Nov 12 2022

%e x - x^2 + 4*x^3 - x^4 + 6*x^5 - 4*x^6 + 8*x^7 - x^8 + 13*x^9 - 6*x^10 + 12*x^11 + ...

%p with(numtheory):

%p a:= n-> add(`if`(d::odd, -d, 0), d=divisors(n))*(-1)^n:

%p seq(a(n), n=1..75); # _Alois P. Heinz_, Apr 07 2017

%t a[ n_] := If[ n < 1, 0, DivisorSum[ n, (-1)^(n + #) n / # &]] (* _Michael Somos_, Jun 17 2012 *)

%t a[ n_] := SeriesCoefficient[(EllipticTheta[ 2, 0, q]^4 - EllipticTheta[ 4, 0, q]^4 + 1) / 24, {q, 0, n}] (* _Michael Somos_, Jun 26 2012 *)

%t Table[CoefficientList[Series[-Log[QPochhammer[-1, -x]/2], {x, 0, 60}],x][[n + 1]] n, {n, 1, 60}] (* _Benedict W. J. Irwin_, Jul 04 2016 *)

%o (PARI) {a(n) = if( n<1, 0, sumdiv( n, d, (-1)^(n + d) * n/d))}

%o (PARI) {a(n) = if( n<1, 0, -(-1)^n * sumdiv( n, d, d%2*d))}

%o (Python)

%o from sympy import divisors

%o def a(n): return 0 if n<1 else -(-1)**n * sum([d%2*d for d in divisors(n)]) # _Indranil Ghosh_, Apr 09 2017

%Y Cf. A000593, A103640.

%K sign,look,mult

%O 1,3

%A _Michael Somos_, Jan 26 2006