A279909 Number of steps to reach 1 or a cycle in the Collatz-like problem '3x/2' and '(x-1)/2'.
0, 2, 1, 3, 3, 3, 2, 8, 3, 4, 4, 7, 4, 6, 3, 11, 9, 6, 4, 15, 5, 12, 5, 11, 8, 6, 5, 7, 7, 14, 4, 18, 11, 10, 10, 11, 7, 9, 5, 11, 16, 6, 6, 15, 13, 12, 6, 17, 12, 9, 9, 11, 7, 11, 6, 19, 8, 8, 8, 11, 15, 14, 5, 24, 19, 14, 11, 13, 11, 13, 11, 16, 12, 8, 8, 10, 10, 10, 6, 16, 11, 17, 17, 18, 7, 26, 7, 24, 16, 11, 14, 13, 13, 15, 7, 23, 18, 14, 13, 23
Offset: 1
Links
- Luca Petrone, Table of n, a(n) for n = 1..19999
- Luca Petrone, Log Plot for the first million terms
Crossrefs
Cf. A006577.
Programs
-
Python
def a(n): if n==1: return 0 l=[n] while True: if n%2==0: n=(n//2)*3 else: n = (n - 1)//2 if not n in l: l+=[n] if n<2: break else: break if l[-1]==1: return len(l)-1 return len(l) for n in range(1, 20001): print(n, a(n)) # Indranil Ghosh, Apr 13 2017
Comments