%I #25 Nov 02 2021 22:24:18
%S 0,2,3,3,3,15,3,6,7,11,8,5,12,5,6,2,7,6,3,10,8,7,7,25,7,22,26,7,7,27,
%T 23,4,4,17,4,12,18,9,4,16,13,15,19,17,18,3,19,2,3,18,20,15,3,5,3,8,19,
%U 8,8,21,8,8,22,15,8,52,8,49,23,19,16,49,8,31,32
%N Triangle read by rows giving trajectory of k/(2n+1) in Collatz problem, k = 1..2n.
%H Michel Lagneau, <a href="/A210483/b210483.txt">Rows n = 0..100 of triangle, flattened</a>
%H J. C. Lagarias, <a href="http://matwbn.icm.edu.pl/ksiazki/aa/aa56/aa5614.pdf">The set of rational cycles for the 3x+1 problem,</a> Acta Arith. 56 (1990), 33-53.
%e The 2nd row [3, 3, 15, 3] gives the number of iterations of k/5 and starts with A210468(2):
%e k=1 => 1/5 -> 8/5 -> 4/5 -> 2/5 with 3 iterations;
%e k=2 => 2/5 -> 1/5 -> 8/5 -> 4/5 with 3 iterations;
%e k=3 => 3/5 -> 14/5 -> 7/5 -> 26/5 -> 13/5 -> 44/5 -> 22/5 -> 11/5 -> 38/5 -> 19/5 -> 62/5 -> 31/5 -> 98/5 -> 49/5 -> 152/5 -> 76/5 with 15 iterations;
%e k=4 => 4/5 -> 2/5 -> 1/5 -> 8/5 with 3 iterations.
%e The array starts:
%e [0];
%e [2, 3];
%e [3, 3, 15, 3];
%e [6, 7, 11, 8, 5, 12];
%e [5, 6, 2, 7, 6, 3, 10, 8];
%e [7, 7, 25, 7, 22, 26, 7, 7, 27, 23];
%e ...
%p with(numtheory): z:={1}:
%p for m from 0 to 20 do:
%p T:=array(1..2*m):k:=0:n:=2*m+1:
%p for nn from 1 to 2*m do:
%p lst:={nn/n}:x0:=nn: ii:=0:
%p for a from 1 to 20 while(ii=0) do:
%p if irem(x0,2)=0 then
%p x0:=x0/2:lst:=lst union{x0/n} :else ii:=1:fi:
%p od:
%p x:=x0*3+n: lst:=lst union {x/n}:
%p for i from 1 to 6000 do:
%p x:=x/2: lst:=lst union {x/n}: if irem(x,2)=1 then
%p x0:=x:x:=x0*3+n: lst:=lst union {x/n}:else fi:
%p od:
%p n0:=nops(lst):if lst intersect z = {1} then
%p n1:=n0-2: k:=k+1: T[k]:=n1: else n1:=n0-1: k:=k+1:T[k]:=n1:fi:
%p od:
%p print (T):
%p od:
%t Collatz[n_] := NestWhileList[If[EvenQ[Numerator[#]], #/2, 3 # + 1] &, n, UnsameQ, All]; t = Join[{{0}}, Table[s = Collatz[k/(2*n + 1)]; len = Length[s] - 2; If[s[[-1]] == 2, len = len - 1]; len, {n, 10}, {k, 2*n}]]; Flatten[t] (* _T. D. Noe_, Jan 23 2013 *)
%Y Cf. A210468.
%K nonn,tabf
%O 0,2
%A _Michel Lagneau_, Jan 23 2013