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.

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.)

This page as a plain text file.
%I A226131 #21 Apr 27 2025 09:08:07
%S A226131 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,
%T A226131 -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,
%U A226131 3,14,-3,5,7,-5,11,-2,5,8,-5,7,-3,10,-1,7,13,-7
%N 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.)
%C A226131 Let S be the set of numbers defined by these rules:  1 is in S, and if nonzero x is in S, then x + 1 and -1/x are in S.  Then S is the set of all rational numbers, produced in generations as follows: g(1) = (1), g(2) = (2, -1), g(3) = (3, -1/2, 0), g(4) = (4, -1/3, 1/2), ... For n > 4, once g(n-1) = (c(1), ..., c(z)) is defined, g(n) is formed from the vector (c(1)+1, -1/c(1), c(2)+1, -1/c(2), ..., c(z)+1, -1/c(z)) by deleting previously generated elements.
%C A226131 Let S' denote the sequence formed by concatenating the generations.
%C A226131   A226130:  Denominators of terms of S'
%C A226131   A226131:  Numerators of terms of S'
%C A226131   A226136:  Positions of positive integers in S'
%C A226131   A226137:  Positions of integers in S'
%H A226131 Clark Kimberling, <a href="/A226131/b226131.txt">Table of n, a(n) for n = 1..1000</a>
%H A226131 Peter Kagey, <a href="/A226131/a226131.pdf">Illustration of the first seven generations</a>.
%H A226131 <a href="/index/Fo#fraction_trees">Index entries for fraction trees</a>
%e A226131 Rationals in S': 1/1, 2/1, -1/1, 3/1, -1/2, 0/1, 4/1, -1/3, 1/2, ...
%t A226131 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 *)
%t A226131 Map[g, Range[z]]; Table[Length[g[i]], {i, 1, z}] (* cf A003410 *)
%t A226131 f = Flatten[Map[g, Range[z]]];
%t A226131 Take[Denominator[f], 100] (* A226130 *)
%t A226131 Take[Numerator[f], 100]    (* A226131 *)
%t A226131 p1 = Flatten[Table[Position[f, n], {n, 1, z}]] (* A226136 *)
%t A226131 p2 = Flatten[Table[Position[f, -n], {n, 0, z}]];
%t A226131 Union[p1, p2]  (* A226137 *) (* _Peter J. C. Moses_, May 26 2013 *)
%Y A226131 Cf. A226080 (rabbit ordering of positive rationals), A226247.
%Y A226131 Cf. A226130, A226136, A226137.
%K A226131 sign,frac,tabf
%O A226131 1,2
%A A226131 _Clark Kimberling_, May 28 2013