A192984 In repeated iterations of function m->m/3 if m == 0 (mod 3), m->4m+a if 4m+a == 0 (mod 3) where a = 1 or 2, a(n) is maximum value achieved if starting from n.
9, 9, 9, 18, 189, 9, 189, 189, 9, 189, 189, 18, 54, 189, 189, 189, 189, 18, 189, 81, 189, 189, 189, 189, 333, 189, 27, 189, 117, 189, 189, 234, 189, 333, 189, 36, 270, 189, 54, 162, 297, 189, 234, 1017, 189, 333, 189, 189, 198, 270, 189, 378, 909, 54
Offset: 1
Keywords
Examples
a(4)=18 since iteration starts: 4, 18, 6, 2, 9, 3, 1, 6,... and 18 is highest value.
Crossrefs
Cf. A194428.
Programs
-
Maple
with(numtheory):T:=array(1..2000):for n from 1 to 100 do: T[1]:=n:n0:=n:k:=2:for it from 1 to 50 do: z:=irem(n0,3):if z=0 then n0:=n0/3:T[k]:=n0:k:=k+1:else n0:=4*n0 + 1:if irem(n0,3)=0 then T[k]:=n0:k:=k+1:else n0:=n0+1:T[k]:=n0:k:=k+1:fi:fi:od:U:=convert(T,set):n1:=nops(U):maxi:=0:for i from 1 to n1 do: if T[i]> maxi then maxi:=T[i]:else fi:od:printf(`%d, `, maxi):od:
Comments