OFFSET
1,2
COMMENTS
This Collatz-like problem is as follows: start with any number n. If n is even, divide it by 2 and multiply by 3, otherwise subtract 1 and divide it by 2.
The iteration always reach {1} or the cycles {4, 6, 9} and {16 , 24 , 36 , 54 , 81 , 40 , 60 , 90 , 135 , 67 , 33}.
LINKS
Luca Petrone, Table of n, a(n) for n = 1..19999
Luca Petrone, Log Plot for the first million terms
PROG
(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 str(n)+" "+str(a(n)) # Indranil Ghosh, Apr 13 2017
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Luca Petrone, Apr 11 2017
STATUS
approved