A226131 Numerators of rational numbers as generated by the rules: 1 is in S, and if nonzero x is in S, then x+1 and -1/x are in S. (See Comments.)
1, 2, -1, 3, -1, 0, 4, -1, 1, 5, -1, 2, 3, -2, 6, -1, 3, 5, -3, 5, -2, 7, -1, 4, 7, -4, 8, -3, 7, -2, 1, 8, -1, 5, 9, -5, 11, -4, 11, -3, 2, 9, -2, 3, 4, -3, 9, -1, 6, 11, -6, 14, -5, 15, -4, 3, 14, -3, 5, 7, -5, 11, -2, 5, 8, -5, 7, -3, 10, -1, 7, 13, -7
Offset: 1
Examples
Rationals in S': 1/1, 2/1, -1/1, 3/1, -1/2, 0/1, 4/1, -1/3, 1/2, ...
Links
- Clark Kimberling, Table of n, a(n) for n = 1..1000
- Peter Kagey, Illustration of the first seven generations.
- Index entries for fraction trees
Crossrefs
Programs
-
Mathematica
g[1] := {1}; z = 20; g[n_] := g[n] = DeleteCases[Flatten[Transpose[{# + 1, -1/#}]]&[DeleteCases[g[n - 1], 0]], Apply[Alternatives, Flatten[Map[g, Range[n - 1]]]]]; Flatten[Map[g, Range[7]]] (* ordered rationals *) Map[g, Range[z]]; Table[Length[g[i]], {i, 1, z}] (* cf A003410 *) f = Flatten[Map[g, Range[z]]]; Take[Denominator[f], 100] (* A226130 *) Take[Numerator[f], 100] (* A226131 *) p1 = Flatten[Table[Position[f, n], {n, 1, z}]] (* A226136 *) p2 = Flatten[Table[Position[f, -n], {n, 0, z}]]; Union[p1, p2] (* A226137 *) (* Peter J. C. Moses, May 26 2013 *)
Comments