|
|
|
|
159, 6, 5, 10, 20, 40, 80, 160, 320, 640, 1280, 2560, 5120, 10240, 20480, 40960, 81920, 163840, 327680, 655360, 1310720, 2621440, 5242880, 10485760, 20971520, 41943040, 83886080, 167772160, 335544320, 671088640, 1342177280, 2684354560, 5368709120, 10737418240
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
3,1
|
|
COMMENTS
|
A006667: number of tripling steps to reach 1 in '3x+1' problem.
A006577: number of halving and tripling steps to reach 1 in '3x+1' problem.
|
|
LINKS
|
|
|
FORMULA
|
G.f.: x^3*(159 - 312*x - 7*x^2) / (1 - 2*x).
a(n) = 2*a(n-1) for n>5.
(End)
|
|
EXAMPLE
|
|
|
MAPLE
|
nn:=10^12:
for n from 3 to 35 do:
ii:=0:
for k from 2 to 10^6 while(ii=0) do:
m:=k:s1:=0:s2:=0:
for i from 1 to nn while(m<>1) do:
if irem(m, 2)=0
then
s2:=s2+1:m:=m/2:
else
s1:=s1+1:m:=3*m+1:
fi:
od:
if n*s1=s1+s2
then
ii:=1: printf(`%d, `, k):
else
fi:
od:od:
|
|
MATHEMATICA
|
f[u_]:=Module[{a=u, k=0}, While[a!=1, k++; If[EvenQ[a], a=a/2, a=a*3+1]]; k]; Table[f[u], {u, 10^7}]; g[v_]:=Count[Differences[NestWhileList[If[EvenQ[#], #/2, 3#+1]&, v, #>1&]], _?Positive]; Table[g[v], {v, 10^7}]; Do[k=3; While[g[k]/f[k]!=1/n, k++]; Print[n, " ", k], {n, 3, 35}]
|
|
PROG
|
(PARI) a(n) = if(n < 5, [0, 0, 159, 6][n], 5<<(n-5)) \\ David A. Corneth, Jun 01 2017
(PARI) Vec(x^3*(159 - 312*x - 7*x^2) / (1 - 2*x) + O(x^50)) \\ Colin Barker, Jun 01 2017
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|