OFFSET
1,3
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = Sum_{k=1..n} (-1)^(k+1) * sigma_[k mod 2](k), where sigma_[0](n) = tau(n), the number of divisors of n and sigma_[1](n) = sigma(n), the sum of the divisors of n.
a(p^k) - a(p^k-1) = (p^(k+1)-1)/(p-1), where p is an odd prime and k is a positive integer. - Wesley Ivan Hurt, May 15 2020
EXAMPLE
a(1) = sigma(1) = 1;
a(2) = sigma(1) - tau(2) = 1 - 2 = -1;
a(3) = sigma(1) - tau(2) + sigma(3) = 1 - 2 + 4 = 3;
a(4) = sigma(1) - tau(2) + sigma(3) - tau(4) = 1 - 2 + 4 - 3 = 0;
MAPLE
f:= proc(n) if n::odd then numtheory:-sigma(n) else -numtheory:-tau(n) fi end proc:
ListTools:-PartialSums(map(f, [$1..100])); # Robert Israel, May 15 2020
MATHEMATICA
Table[Sum[(-1)^(k + 1)*DivisorSigma[Mod[k, 2], k], {k, n}], {n, 100}]
PROG
(PARI) a(n) = sum(k=1, n, (-1)^(k+1)*sigma(k, k % 2)); \\ Michel Marcus, May 14 2020
CROSSREFS
KEYWORD
sign
AUTHOR
Wesley Ivan Hurt, May 13 2020
STATUS
approved