login
A185023
Number of steps to reach the number 1 of the map n -> n/3 if x==0 (mod 3), n -> (4n-1)/3 if x==1 (mod 3), n -> (4n+1)/3 if x==2 (mod 3).
1
0, 2, 1, 5, 4, 3, 3, 7, 2, 21, 6, 6, 20, 10, 5, 5, 19, 4, 9, 4, 4, 23, 18, 8, 8, 8, 3, 27, 22, 22, 17, 12, 7, 7, 7, 7, 26, 21, 21, 16, 16, 11, 11, 11, 6, 6, 6, 6, 25, 20, 20, 20, 15, 5, 15, 10, 10, 10, 10, 5, 5, 29, 5, 24, 24, 24, 19, 19, 19, 19, 14, 9, 14, 9
OFFSET
1,2
COMMENTS
A variation of the "3x+1" problem. - T. D. Noe, Feb 06 2012
LINKS
EXAMPLE
a(8) = 7 because the trajectory of 8 is 8 -> 11 -> 15 -> 5 -> 7-> 9 -> 3-> 1 with 7 iterations.
MAPLE
T:=array(0..2):for n from 1 to 100 do:ii:=0:n0:=n: i:=0:for it from 1 to 100 while(ii=0) do:T[0]:=n0/3: T[1]:=(4*n0-1)/3: T[2]:=(4*n0+1)/3:r:=irem(n0, 3):n0:=T[r]: i:=i+1:if n0=1 then ii:=1: else fi:od: printf(`%d, `, i):od:
MATHEMATICA
nxt[n_]:=Module[{m=Mod[n, 3]}, Which[m==0, n/3, m==1, (4n-1)/3, m==2, (4n+1)/3]]; Table[Length[NestWhileList[nxt, n, #!=1&]]-1, {n, 80}] (* Harvey P. Dale, Jul 20 2013 *)
CROSSREFS
Cf. A006577 (3x+1 problem).
Sequence in context: A275183 A275131 A280513 * A372501 A061579 A094064
KEYWORD
nonn
AUTHOR
Michel Lagneau, Feb 04 2012
STATUS
approved