login
a(0) = 0; thereafter a(n) = a(n-1) + sigma(n) if sigma(n) > a(n-1), otherwise a(n) = a(n-1) - sigma(n), where sigma is the sum of divisors function A000203.
2

%I #29 May 14 2022 19:05:52

%S 0,1,4,0,7,1,13,5,20,7,25,13,41,27,3,27,58,40,1,21,63,31,67,43,103,72,

%T 30,70,14,44,116,84,21,69,15,63,154,116,56,0,90,48,144,100,16,94,22,

%U 70,194,137,44,116,18,72,192,120,0,80,170,110,278,216,120,16

%N a(0) = 0; thereafter a(n) = a(n-1) + sigma(n) if sigma(n) > a(n-1), otherwise a(n) = a(n-1) - sigma(n), where sigma is the sum of divisors function A000203.

%H Alois P. Heinz, <a href="/A330725/b330725.txt">Table of n, a(n) for n = 0..20000</a>

%p a:= proc(n) option remember; `if`(n=0, 0, ((s, t)-> s+

%p `if`(s<t, t, -t))(a(n-1), numtheory[sigma](n)))

%p end:

%p seq(a(n), n=0..80);

%t nxt[{n_,a_}]:={n+1,If[DivisorSigma[1,n+1]>a,a+DivisorSigma[1,n+1],a- DivisorSigma[ 1,n+1]]}; NestList[nxt,{0,0},70][[All,2]] (* _Harvey P. Dale_, May 14 2022 *)

%Y Cf. A000203, A008344, A008345, A008348, A076042, A111466, A126646, A327442, A331165.

%K nonn,look

%O 0,3

%A _Alois P. Heinz_, Jan 11 2020