login
a(n) = a(n-1) + A000005(n-1) if a(n-1) is not divisible by 3, otherwise a(n) = a(n-1)/3.
1

%I #16 Mar 22 2022 03:12:09

%S 1,2,4,6,2,4,8,10,14,17,21,7,13,15,5,9,3,1,7,9,3,1,5,7,15,5,9,3,1,3,1,

%T 3,1,5,9,3,1,3,1,5,13,15,5,7,13,19,23,25,35,38,44,48,16,18,6,2,10,14,

%U 18,6,2,4,8,14,21,7,15,5,11,15,5,7,19,21,7,13,19,23

%N a(n) = a(n-1) + A000005(n-1) if a(n-1) is not divisible by 3, otherwise a(n) = a(n-1)/3.

%H Michael De Vlieger, <a href="/A133903/b133903.txt">Table of n, a(n) for n = 1..10000</a>

%t Nest[Append[#1, If[Divisible[Last[#1], 3], Last[#1]/3, Last[#1] + DivisorSigma[0, #2]]] & @@ {#, Length[#]} &, {1}, 77] (* _Michael De Vlieger_, Mar 21 2022 *)

%o (PARI) lista(nn) = {my(va = vector(nn)); va[1] = 1; for (n=2, nn, va[n] = if (va[n-1] % 3, va[n-1] + numdiv(n-1), va[n-1]/3);); va;} \\ _Michel Marcus_, Nov 28 2020

%Y Cf. A000005 (number of divisors).

%K easy,nonn

%O 1,2

%A _Ctibor O. Zizka_, Jan 07 2008

%E Corrected and extended by _Michel Marcus_, Nov 28 2020