OFFSET
1,3
LINKS
N. J. A. Sloane, Table of n, a(n) for n = 1..10000
Eric Roosendaal, On the 3x + 1 problem
N. J. A. Sloane, First 36 terms of A217934 and A060412 [From Roosendaal web site]
FORMULA
EXAMPLE
MATHEMATICA
Prepend[Table[Length[NestWhileList[If[EvenQ[#], #/2, 3#+1]&, n, #>=n&]], {n, 2, 99}], 1]-1 (* Jayanta Basu, May 28 2013 *)
PROG
(Python)
def a(n):
if n<3: return n - 1
N=n
x=0
while True:
if n%2==0: n//=2
else: n = 3*n + 1
x+=1
if n<N: return x
print([a(n) for n in range(1, 101)]) # Indranil Ghosh, Apr 22 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Sep 15 2006
STATUS
approved