OFFSET
0,3
COMMENTS
Is this sequence nonnegative?
As tau(n) is odd when n is a square, there are alternating strings of even and odd integers with change of parity for each n square. Indeed, between m^2 and (m+1)^2-1, there is a string of 2m+1 even terms if m is odd, or a string of 2m+1 odd terms if m is even. - Bernard Schott, Jul 10 2019
LINKS
Michel Marcus, Table of n, a(n) for n = 0..5000
FORMULA
a(n) = 1 + Sum_{k=1..n} (-1)^k A000005(k).
For n > 0, a(n) = 1 + A307704(n).
If p prime, a(p) = a(p-1) - 2. - Bernard Schott, Jul 10 2019
EXAMPLE
The first 6 terms of A000005 are 1, 2, 2, 3, 2, 4, so a(6) = 1 - 1 + 2 - 2 + 3 - 2 + 4 = 5.
MATHEMATICA
Accumulate[Table[If[k==0, 1, (-1)^k*DivisorSigma[0, k]], {k, 0, 30}]]
PROG
(PARI) a(n) = 1 - sum(k=1, n, (-1)^(k+1)*numdiv(k)); \\ Michel Marcus, Jul 09 2019
(Magma) [1] cat [1+(&+[(-1)^(k)*#Divisors(k):k in [1..n]]):n in [1..70]]; // Marius A. Burtea, Jul 10 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
Gus Wiseman, Jul 06 2019
STATUS
approved