OFFSET
1,2
LINKS
Arkadiusz Wesolowski, Table of n, a(n) for n = 1..10000
Eric Weisstein's World of Mathematics, Collatz Problem
FORMULA
For larger n, a(n) ~ 13.5*n.
a(2n) = 1 + a(2n-1) for n >= 2. - Alexandre Herrera, Jul 11 2023
MATHEMATICA
Table[Length[NestWhileList[If[OddQ@#, 3 # + 1, #/2] &, 2^n - 1, # > 1 &]] - 1, {n, 60}] (* Arkadiusz Wesolowski, Sep 16 2011 *)
PROG
(Python)
for i in range(1, 100):
n = 2**i - 1
x = n
c = 0
while x != 1:
c = c + 1
if (x & 1) == 0:
x = x//2
else:
x = 3*x + 1
print(c)
# David Rabahy, Sep 18 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Arkadiusz Wesolowski, Aug 02 2011
STATUS
approved