login
a(n) = sigma(1) - tau(2) + sigma(3) - tau(4) + sigma(5) - tau(6) + ... - (up to n).
4

%I #16 May 15 2020 12:04:59

%S 1,-1,3,0,6,2,10,6,19,15,27,21,35,31,55,50,68,62,82,76,108,104,128,

%T 120,151,147,187,181,211,203,235,229,277,273,321,312,350,346,402,394,

%U 436,428,472,466,544,540,588,578,635,629,701,695,749,741,813,805,885,881,941,929

%N a(n) = sigma(1) - tau(2) + sigma(3) - tau(4) + sigma(5) - tau(6) + ... - (up to n).

%H Robert Israel, <a href="/A334874/b334874.txt">Table of n, a(n) for n = 1..10000</a>

%F 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.

%F 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

%e a(1) = sigma(1) = 1;

%e a(2) = sigma(1) - tau(2) = 1 - 2 = -1;

%e a(3) = sigma(1) - tau(2) + sigma(3) = 1 - 2 + 4 = 3;

%e a(4) = sigma(1) - tau(2) + sigma(3) - tau(4) = 1 - 2 + 4 - 3 = 0;

%p f:= proc(n) if n::odd then numtheory:-sigma(n) else -numtheory:-tau(n) fi end proc:

%p ListTools:-PartialSums(map(f,[$1..100])); # _Robert Israel_, May 15 2020

%t Table[Sum[(-1)^(k + 1)*DivisorSigma[Mod[k, 2], k], {k, n}], {n, 100}]

%o (PARI) a(n) = sum(k=1, n, (-1)^(k+1)*sigma(k, k % 2)); \\ _Michel Marcus_, May 14 2020

%Y Cf. A000005 (tau), A000203 (sigma), A245466.

%K sign

%O 1,3

%A _Wesley Ivan Hurt_, May 13 2020