%I #20 Jul 17 2017 07:19:13
%S 159,6,5,10,20,40,80,160,320,640,1280,2560,5120,10240,20480,40960,
%T 81920,163840,327680,655360,1310720,2621440,5242880,10485760,20971520,
%U 41943040,83886080,167772160,335544320,671088640,1342177280,2684354560,5368709120,10737418240
%N Least k such that A006667(k)/A006577(k) = 1/n.
%C A006667: number of tripling steps to reach 1 in '3x+1' problem.
%C A006577: number of halving and tripling steps to reach 1 in '3x+1' problem.
%C a(n) = {159, 6} union {A020714}.
%H Colin Barker, <a href="/A287798/b287798.txt">Table of n, a(n) for n = 3..1000</a>
%H <a href="/index/Rec#order_01">Index entries for linear recurrences with constant coefficients</a>, signature (2).
%F For n >= 5, a(n) = 5*2^n/32. - _David A. Corneth_, Jun 01 2017
%F From _Colin Barker_, Jun 01 2017: (Start)
%F G.f.: x^3*(159 - 312*x - 7*x^2) / (1 - 2*x).
%F a(n) = 2*a(n-1) for n>5.
%F (End)
%e a(3) = 159 because A006667(159)/A006577(159) = 18/54 = 1/3.
%p nn:=10^12:
%p for n from 3 to 35 do:
%p ii:=0:
%p for k from 2 to 10^6 while(ii=0) do:
%p m:=k:s1:=0:s2:=0:
%p for i from 1 to nn while(m<>1) do:
%p if irem(m,2)=0
%p then
%p s2:=s2+1:m:=m/2:
%p else
%p s1:=s1+1:m:=3*m+1:
%p fi:
%p od:
%p if n*s1=s1+s2
%p then
%p ii:=1: printf(`%d, `,k):
%p else
%p fi:
%p od:od:
%t 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}]
%o (PARI) a(n) = if(n < 5, [0,0,159,6][n], 5<<(n-5)) \\ _David A. Corneth_, Jun 01 2017
%o (PARI) Vec(x^3*(159 - 312*x - 7*x^2) / (1 - 2*x) + O(x^50)) \\ _Colin Barker_, Jun 01 2017
%Y Cf. A006577, A006666, A006667. Essentially the same as A020714, A084215, A146523 and A257113.
%K nonn,easy
%O 3,1
%A _Michel Lagneau_, Jun 01 2017
|