%I #28 Sep 08 2022 08:46:24
%S 1,0,2,0,3,1,5,3,7,4,8,6,12,10,14,10,15,13,19,17,23,19,23,21,29,26,30,
%T 26,32,30,38,36,42,38,42,38,47,45,49,45,53,51,59,57,63,57,61,59,69,66,
%U 72,68,74,72,80,76,84,80,84,82,94,92,96,90,97,93,101,99
%N a(n) = 1 - tau(1) + tau(2) - tau(3) + ... + (-1)^n tau(n), where tau = A000005 is number of divisors.
%C Is this sequence nonnegative?
%C 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
%H Michel Marcus, <a href="/A326440/b326440.txt">Table of n, a(n) for n = 0..5000</a>
%F a(n) = 1 + Sum_{k=1..n} (-1)^k A000005(k).
%F For n > 0, a(n) = 1 + A307704(n).
%F If p prime, a(p) = a(p-1) - 2. - _Bernard Schott_, Jul 10 2019
%e The first 6 terms of A000005 are 1, 2, 2, 3, 2, 4, so a(6) = 1 - 1 + 2 - 2 + 3 - 2 + 4 = 5.
%t Accumulate[Table[If[k==0,1,(-1)^k*DivisorSigma[0,k]],{k,0,30}]]
%o (PARI) a(n) = 1 - sum(k=1, n, (-1)^(k+1)*numdiv(k)); \\ _Michel Marcus_, Jul 09 2019
%o (Magma) [1] cat [1+(&+[(-1)^(k)*#Divisors(k):k in [1..n]]):n in [1..70]]; // _Marius A. Burtea_, Jul 10 2019
%Y Cf. A000005, A001222, A008683, A054519, A071321, A195017, A268387, A307704, A316523, A316524, A319273.
%K nonn
%O 0,3
%A _Gus Wiseman_, Jul 06 2019