OFFSET
1,3
LINKS
MATHEMATICA
Accumulate @ Table[-1 + Length @ NestWhileList[If[OddQ[#], 3*# + 1, #/2] &, n, ! IntegerQ @ Log[2, #] &], {n, 1, 64}] (* Amiram Eldar, Apr 09 2022 *)
PROG
(PARI) ispow2(n)=n>>=valuation(n, 2); n==1;
f(n) = my(s); while(!ispow2(n), n=if(n%2, 3*n+1, n/2); s++); s; \\ A208981
a(n) = sum(i=1, n, f(i)); \\ Michel Marcus, Apr 13 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Omar E. Pol, Apr 09 2022
STATUS
approved