A258237 Irregular triangle (Beatty tree for r = sqrt(2)), T, of all nonnegative integers, each exactly once, as described in Comments.
0, 1, 2, 4, 3, 7, 5, 11, 8, 16, 6, 12, 24, 9, 18, 17, 35, 14, 13, 25, 26, 50, 10, 19, 21, 38, 36, 72, 15, 28, 27, 31, 52, 51, 55, 103, 20, 22, 37, 39, 41, 45, 73, 74, 79, 147, 32, 29, 56, 53, 59, 65, 106, 104, 113, 209, 23, 42, 40, 46, 76, 75, 80, 84, 93
Offset: 1
Examples
Rows (or generations, or levels) of T: 0 1 2 4 3 7 5 1 8 16 6 12 24 9 18 17 35 14 13 25 26 50 10 19 21 38 36 72 15 28 27 31 52 51 55 103 Generations 0 to 10 of the tree are drawn by the Mathematica program. In T, the path from 0 to 36 is (0,1,2,4,7,11,16,24,17,25,36). The path obtained by backtracking (i.e., successive applications of the mapping b in Comments) is (36,25,17,24,16,11,7,4,2,1,0).
Programs
-
Mathematica
r = Sqrt[2]; k = 1000; w = Map[Floor[r #] &, Range[k]]; f[x_] := f[x] = If[MemberQ[w, x], Floor[x/r], Floor[r*x]]; b := NestWhileList[f, #, ! # == 0 &] &; bs = Map[Reverse, Table[b[n], {n, 0, k}]]; generations = Table[DeleteDuplicates[Map[#[[n]] &, Select[bs, Length[#] > n - 1 &]]], {n, 11}] paths = Sort[Map[Reverse[b[#]] &, Last[generations]]] graph = DeleteDuplicates[Flatten[Map[Thread[Most[#] -> Rest[#]] &, paths]]] TreePlot[graph, Top, 0, VertexLabeling -> True, ImageSize -> 700] Map[DeleteDuplicates, Transpose[paths]] (* Peter J. C. Moses,May 21 2015 *)
Comments