%I #31 Jun 13 2017 03:54:10
%S 1,2,3,8,4,4,3,1,4,7,6,5,16,8,6,9,10,4,12,7,8,17,2,1,9,3,8,5,4,5,17,6,
%T 8,26,5,18,20,6,14,13,7,8,18,19,9,7,8,4,1,4,23,5,4,9,32,15,11,7,10,12,
%U 27,13,20,22,33,11,10,11,2,32,9,8,19,3,9,17,12
%N The length of the Collatz (3k+1) sequence for all odd fractions and integers.
%C This sequence is the unification, in the limit, of the length of Collatz sequences for all fractions whose denominator is odd, and also all integers.
%C The sequence A210483 gives the triangle read by rows giving the trajectory of k/(2n+1) in the Collatz problem, k = 1..2n, but particular attention should be paid to numbers in the triangle T(n,k) = (n-k)/(2k+1) for n = 1,2,... and k = 0..n-1.
%C The example shown below gives a general idea of this regular triangle. This contains all fractions whose denominator is odd and all integers. Now, from T(n,k) we could introduce a 3D triangle in order to produce a complete Collatz sequence starting from each rational T(n,k).
%C The initial triangle T(n,k) begins
%C 1;
%C 2, 1/3;
%C 3, 2/3, 1/5,;
%C 4, 3/3, 2/5, 1/7;
%C 5, 4/3, 3/5, 2/7, 1/9;
%C 6, 5/3, 4/5, 3/7, 2/9, 1/11;
%C ...
%H Michel Lagneau, <a href="/A210688/b210688.txt">Rows n = 1..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.
%F a(n) = A210516(n) + 1.
%e The triangle of lengths begins
%e 1;
%e 2, 3;
%e 8, 4, 4;
%e 3, 1, 4, 7;
%e 6, 5, 16, 8, 6;
%e ...
%e Individual numbers have the following Collatz sequences (including the first term):
%e [1] => [1] because: 1 -> 1 with 1 iteration;
%e [2 1/3] => [2, 3] because: 2 -> 2 -> 1 => 2 iterations; 1/3 -> 1/3 -> 2 -> 1 => 3 iterations;
%e [3 2/3 1/5] => [8, 4, 4] because: 3 -> 3->10->5->16->8->4->2->1 => 8 iterations; 2/3 -> 2/3 -> 1/3 -> 2 -> 1 => 4 iterations; 1/5 -> 1/5 -> 8/5 -> 4/5 -> 2/5 => 4 iterations.
%t Collatz2[n_] := Module[{lst = NestWhileList[If[EvenQ[Numerator[#]], #/2, 3 # + 1] &, n, Unequal, All]}, If[lst[[-1]] == 1, lst = Drop[lst, -3], If[lst[[-1]] == 2, lst = Drop[lst, -2], If[lst[[-1]] == 4, lst = Drop[lst, -1], If[MemberQ[Rest[lst], lst[[-1]]], lst = Drop[lst, -1]]]]]]; t = Table[s = Collatz2[(n - k)/(2*k + 1)]; Length[s] , {n, 12}, {k, 0, n - 1}]; Flatten[t] (* _T. D. Noe_, Jan 28 2013 *)
%Y Cf. A210516.
%K nonn,tabl
%O 1,2
%A _Michel Lagneau_, Jan 29 2013