%I M3236 N1307 #71 Sep 26 2022 20:32:38
%S 1,-1,4,-5,6,-4,8,-13,13,-6,12,-20,14,-8,24,-29,18,-13,20,-30,32,-12,
%T 24,-52,31,-14,40,-40,30,-24,32,-61,48,-18,48,-65,38,-20,56,-78,42,
%U -32,44,-60,78,-24,48,-116,57,-31,72,-70,54,-40,72,-104,80,-30,60,-120,62,-32,104,-125
%N Generalized sum of divisors function: excess of sum of odd divisors of n over sum of even divisors of n.
%C Glaisher calls this zeta(n) or zeta_1(n). - _N. J. A. Sloane_, Nov 24 2018
%C Coefficients in expansion of Sum_{n >= 1} x^n/(1+x^n)^2 = Sum_{n >= 1} (-1)^(n-1)*n*x^n/(1-x^n).
%C Unsigned sequence is A113184. - _Peter Bala_, Dec 14 2020
%D L. Comtet, Advanced Combinatorics, Reidel, 1974, p. 162, #16, (6), 3rd formula.
%D Steven R. Finch, Mathematical Constants, Cambridge, 2003, pp. 259-262.
%D N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H Seiichi Manyama, <a href="/A002129/b002129.txt">Table of n, a(n) for n = 1..10000</a> (terms 1..1000 from T. D. Noe)
%H Steven R. Finch, <a href="http://www.people.fas.harvard.edu/~sfinch/constant/onenin/onenin.html">The "One-Ninth" Constant</a> [Broken link]
%H Steven R. Finch, <a href="http://web.archive.org/web/20010603070928/http://www.mathsoft.com/asolve/constant/onenin/onenin.html">The "One-Ninth" Constant</a> [From the Wayback machine]
%H J. W. L. Glaisher, <a href="https://books.google.com/books?id=bLs9AQAAMAAJ&pg=RA1-PA1">On the representations of a number as the sum of two, four, six, eight, ten, and twelve squares</a>, Quart. J. Math. 38 (1907), 1-62 (see p. 4 and p. 8).
%H Heekyoung Hahn, <a href="http://arxiv.org/abs/1507.04426">Convolution sums of some functions on divisors</a>, arXiv:1507.04426 [math.NT], 2015.
%H P. A. MacMahon, <a href="http://plms.oxfordjournals.org/content/s2-19/1/75.extract">Divisors of numbers and their continuations in the theory of partitions</a>, Proc. London Math. Soc., (2) 19 (1919), 75-113; Coll. Papers II, pp. 303-341.
%H <a href="/index/Ge#Glaisher">Index entries for sequences mentioned by Glaisher</a>
%F Multiplicative with a(p^e) = 3-2^(e+1) if p = 2; (p^(e+1)-1)/(p-1) if p > 2. - _David W. Wilson_, Sep 01 2001
%F G.f.: Sum_{n>=1} n*x^n*(1-3*x^n)/(1-x^(2*n)). - _Vladeta Jovovic_, Oct 15 2002
%F L.g.f.: Sum_{n>=1} a(n)*x^n/n = log[ Sum_{n>=0} x^(n(n+1)/2) ], the log of the g.f. of A010054. - _Paul D. Hanna_, Jun 28 2008
%F Dirichlet g.f. zeta(s)*zeta(s-1)*(1-4/2^s). Dirichlet convolution of A000203 and the quasi-finite (1,-4,0,0,0,...). - _R. J. Mathar_, Mar 04 2011
%F a(n) = A000593(n)-A146076(n). - _R. J. Mathar_, Mar 05 2011
%F a(n) = Sum_{j = 1..n} Sum_{k = 1..j} (-1)^(j+1)*cos(2*k*n*Pi/j). - _Peter Bala_, Aug 24 2022
%e a(28) = 40 because the sum of the even divisors of 28 (2, 4, 14 and 28) = 48 and the sum of the odd divisors of 28 (1 and 7) = 8, their absolute difference being 40.
%p A002129 := proc(n) -add((-1)^d*d,d=numtheory[divisors](n)) ; end proc: # _R. J. Mathar_, Mar 05 2011
%t f[n_] := Block[{c = Divisors@ n}, Plus @@ Select[c, EvenQ] - Plus @@ Select[c, OddQ]]; Array[f, 64] (* _Robert G. Wilson v_, Mar 04 2011 *)
%t a[n_] := DivisorSum[n, -(-1)^#*#&]; Array[a, 80] (* _Jean-François Alcover_, Dec 01 2015 *)
%t f[p_, e_] := If[p == 2, 3 - 2^(e + 1), (p^(e + 1) - 1)/(p - 1)]; a[1] = 1; a[n_] := Times @@ (f @@@ FactorInteger[n]); Array[a, 64] (* _Amiram Eldar_, Jul 20 2019 *)
%o (PARI) a(n)=if(n<1,0,-sumdiv(n,d,(-1)^d*d))
%o (PARI) {a(n)=n*polcoeff(log(sum(k=0,(sqrtint(8*n+1)-1)\2,x^(k*(k+1)/2))+x*O(x^n)),n)} \\ _Paul D. Hanna_, Jun 28 2008
%Y A diagonal of A060044.
%Y a(2^n) = -A036563(n+1). a(3^n) = A003462(n+1).
%Y First differences of -A024919(n).
%Y Cf. A010054, A113184.
%K sign,easy,nice,mult
%O 1,3
%A _N. J. A. Sloane_
%E Better description and more terms from _Robert G. Wilson v_, Dec 14 2000
%E More terms from _N. J. A. Sloane_, Mar 19 2001