OFFSET
1,4
COMMENTS
Excess of sum of odd squares dividing n over sum of even squares dividing n.
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..10000
FORMULA
Multiplicative with a(2^e) = 2 - (2^(2*floor(e/2) + 2) - 1)/3, and a(p^e) = (p^(2*floor(e/2) + 2) - 1)/(p^2 - 1) for p > 2. - Amiram Eldar, Nov 15 2022
MATHEMATICA
nmax = 80; CoefficientList[Series[Sum[(-1)^(k + 1) k^2 x^(k^2)/(1 - x^(k^2)), {k, 1, nmax}], {x, 0, nmax}], x] // Rest
Table[DivisorSum[n, (-1)^(# + 1) # &, IntegerQ[#^(1/2)] &], {n, 1, 80}]
f[p_, e_] := (p^(2*Floor[e/2] + 2) - 1)/(p^2 - 1); f[2, e_] := 2 - (2^(2*Floor[e/2] + 2) - 1)/3; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Nov 15 2022 *)
PROG
(PARI) a(n) = sumdiv(n, d, if (issquare(d), (-1)^((d%2)+1)*d)); \\ Michel Marcus, Aug 22 2021
(PARI) a(n) = {my(f = factor(n)); prod(i = 1, #f~, if(f[i, 1]==2, 2 - (2^(2*floor(f[i, 2]/2) + 2) - 1)/3, (f[i, 1]^(2*floor(f[i, 2]/2) + 2) - 1)/(f[i, 1]^2 - 1))); } \\ Amiram Eldar, Nov 15 2022
CROSSREFS
KEYWORD
sign,mult
AUTHOR
Ilya Gutkovskiy, May 14 2021
STATUS
approved