cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A210483 Triangle read by rows giving trajectory of k/(2n+1) in Collatz problem, k = 1..2n.

Original entry on oeis.org

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, 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, 8, 8, 21, 8, 8, 22, 15, 8, 52, 8, 49, 23, 19, 16, 49, 8, 31, 32
Offset: 0

Views

Author

Michel Lagneau, Jan 23 2013

Keywords

Examples

			The 2nd row [3, 3, 15, 3] gives the number of iterations of k/5 and starts with A210468(2):
k=1 => 1/5 -> 8/5 -> 4/5 -> 2/5 with 3 iterations;
k=2 => 2/5 -> 1/5 -> 8/5 -> 4/5 with 3 iterations;
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;
k=4 => 4/5 -> 2/5 -> 1/5 -> 8/5 with 3 iterations.
The array starts:
  [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, 23];
  ...
		

Crossrefs

Cf. A210468.

Programs

  • Maple
    with(numtheory): z:={1}:
       for m from 0 to 20 do:
                 T:=array(1..2*m):k:=0:n:=2*m+1:
          for nn from 1 to 2*m do:
                 lst:={nn/n}:x0:=nn: ii:=0:
            for a from 1 to 20 while(ii=0) do:
                 if irem(x0,2)=0 then
                 x0:=x0/2:lst:=lst union{x0/n} :else ii:=1:fi:
            od:
                 x:=x0*3+n: lst:=lst union {x/n}:
                   for i from 1 to 6000 do:
                x:=x/2: lst:=lst union {x/n}:  if irem(x,2)=1 then
                x0:=x:x:=x0*3+n: lst:=lst union {x/n}:else fi:
               od:
              n0:=nops(lst):if lst intersect z = {1} then
              n1:=n0-2: k:=k+1: T[k]:=n1: else n1:=n0-1: k:=k+1:T[k]:=n1:fi:
       od:
         print (T):
    od:
  • Mathematica
    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 *)