OFFSET
1,2
LINKS
Seiichi Manyama, Table of n, a(n) for n = 1..10000
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
G.f.: Sum_{k>=1} (-1)^(k-1)*k^2*x^k/(1 - x^k). - Ilya Gutkovskiy, Dec 23 2018
G.f.: Sum_{n >= 1} x^n*(1 - x^n)/(1 + x^n)^3. - Peter Bala, Jan 11 2021
Multiplicative with a(2^e) = 2 - (2^(2*e + 2) - 1)/3, and a(p^e) = (p^(2*e + 2) - 1)/(p^2 - 1) for p > 2. - Amiram Eldar, Nov 04 2022
MAPLE
with(numtheory):
a := n -> add( (-1)^(d-1)*d^2, d in divisors(n) ): seq(a(n), n = 1..40);
# Peter Bala, Jan 11 2021
MATHEMATICA
f[p_, e_] := (p^(2*e + 2) - 1)/(p^2 - 1); f[2, e_] := 2 - (2^(2*e + 2) - 1)/3; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 55] (* Amiram Eldar, Nov 04 2022 *)
PROG
(PARI) apply( a(n)=sumdiv(n, d, (-1)^(d-1)*d^2), [1..30]) \\ M. F. Hasler, Nov 26 2018
CROSSREFS
KEYWORD
sign,mult
AUTHOR
N. J. A. Sloane, Nov 23 2018
STATUS
approved