OFFSET
1,2
LINKS
G. C. Greubel, Table of n, a(n) for n = 1..5000
Peter Bala, A signed Dirichlet product of arithmetical functions, 2019.
Subhash Chand Bhoria, Pramod Eyyunni, and Bibekananda Maji, Generalization of five q-series identities of Ramanujan and unexplored weighted partition identities, arXiv:2011.07767 [math.NT], 2020.
J. W. L. Glaisher, On the representations of a number as the sum of two, four, six, eight, ten, and twelve squares, Quart. J. Math. 38 (1907), 1-62 (see p. 4 and p. 8).
FORMULA
a(n) = number of divisors of n minus 4 times number of divisors of n of the form 4*k+2.
a(n) = Sum_{d|n} (-1)^(d+n/d). - N. J. A. Sloane, Nov 23 2018
Multiplicative with a(2^e) = e-3 if e>0, a(p^e) = e+1 if p>2.
Moebius transform is period 4 sequence [1, -3, 1, 1, ...].
G.f.: Sum_{k>0} x^k / (1 - x^k) - 4 * x^(4*k + 2) / (1 - x^(4*k + 2)).
a(2*n - 1) = A099774(n).
Dirichlet g.f.: zeta(s)^2*(1-2^(-s+1))^2 = eta^2(s) (the Dirichlet eta). - Ralf Stephan, Mar 27 2015
a(16n+8) = a(A051062(n)) = 0. - Michel Marcus, Mar 27 2015
O.g.f.: Sum_{n >= 1} (-1)^(n*(n+1))*x^(n^2)*(1 - x^n)/(1 + x^n). - Peter Bala, Mar 11 2019
Conjecture: a(n) = (7 - 2*(-1)^n)*tau(n) - 4*tau(2*n) = 5*tau(n) - (3 + (-1)^n)*tau(2*n), where tau = A000005. - Velin Yanev, Dec 17 2019
The proof of the above conjecture easily follows from the fact that both a(n) and tau(n) are multiplicative arithmetical functions and tau(p^e) = e + 1 for prime p. - Peter Bala, Jan 28 2022
a(n) = A000005(n) if n is odd, and A000005(n) * (A007814(n)-3)/(A007814(n)+1) if n is even. - Amiram Eldar, Sep 18 2023
EXAMPLE
G.f. = x - 2*x^2 + 2*x^3 - x^4 + 2*x^5 - 4*x^6 + 2*x^7 + 3*x^9 - 4*x^10 + ...
MATHEMATICA
a[ n_] := SeriesCoefficient[ Sum[ -(-x)^k / (1 + x^k), {k, 1, n}], {x, 0, n}];
a[ n_] := If[ n < 1, 0, DivisorSum[ n, (-1)^(# + n/#) &]]; (* Michael Somos, Jan 08 2015 *)
a[n_] := Module[{e = IntegerExponent[n, 2]}, DivisorSigma[0, n] * If[e == 0, 1, (e-3)/(e+1)]]; Array[a, 100] (* Amiram Eldar, Sep 18 2023 *)
PROG
(PARI) {a(n) = if( n<1, 0, sumdiv(n, k, (-1)^(k + n/k)))};
(PARI) {a(n) = if( n<1, 0, numdiv(n) - 4 * sumdiv( n, k, k%4 == 2))};
(PARI) {a(n) = my(e); if( n<1, 0, e = valuation( n, 2); numdiv( n/2^e) * if( e>0, e-3, 1))};
(PARI) a(n)=direuler(p=1, n, if(p==2, (1-2*X)^2/(1-X)^2, 1/(1-X)^2))[n] /* Ralf Stephan, Mar 27 2015 */
CROSSREFS
KEYWORD
sign,easy,mult
AUTHOR
Michael Somos, Nov 02 2013
STATUS
approved