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.

A226130 Denominators 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 A226130 #32 Jan 18 2022 03:54:40
%S A226130 1,1,1,1,2,1,1,3,2,1,4,3,2,1,1,5,4,3,2,2,3,1,6,5,4,3,3,5,2,5,3,1,7,6,
%T A226130 5,4,4,7,3,8,5,2,7,5,3,1,1,8,7,6,5,5,9,4,11,7,3,11,8,5,2,2,9,7,5,3,3,
%U A226130 4,1,9,8,7,6,6,11,5,14,9,4,15,11,7,3,3
%N A226130 Denominators 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 A226130 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.  Let S' denote the sequence formed by concatenating the generations.
%C A226130 A226130:  Denominators of terms of S'
%C A226130 A226131:  Numerators of terms of S'
%C A226130 A226136:  Positions of positive integers in S'
%C A226130 A226137:  Positions of integers in S'
%C A226130 The length of row n is given by A226275(n-1). - _Peter Kagey_, Jan 17 2022
%H A226130 Clark Kimberling, <a href="/A226130/b226130.txt">Table of n, a(n) for n = 1..1000</a>
%H A226130 <a href="/index/Fo#fraction_trees">Index entries for fraction trees</a>
%e A226130 The denominators and numerators are read from the rationals in S':
%e A226130   1/1, 2/1, -1/1, 3/1, -1/2, 0/1, 4/1, -1/3, 1/2, ...
%e A226130 Table begins:
%e A226130   n |
%e A226130   --+-----------------------------------------------
%e A226130   1 | 1;
%e A226130   2 | 1, 1;
%e A226130   3 | 1, 2, 1;
%e A226130   4 | 1, 3, 2;
%e A226130   5 | 1, 4, 3, 2, 1;
%e A226130   6 | 1, 5, 4, 3, 2, 2, 3;
%e A226130   7 | 1, 6, 5, 4, 3, 3, 5, 2, 5, 3;
%e A226130   8 | 1, 7, 6, 5, 4, 4, 7, 3, 8, 5, 2, 7, 5, 3, 1;
%t A226130 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 A226130 Map[g, Range[z]]; Table[Length[g[i]], {i, 1, z}] (* cf. A003410 *)
%t A226130 f = Flatten[Map[g, Range[z]]];
%t A226130 Take[Denominator[f], 100] (* A226130 *)
%t A226130 Take[Numerator[f], 100]   (* A226131 *)
%t A226130 p1 = Flatten[Table[Position[f, n], {n, 1, z}]] (* A226136 *)
%t A226130 p2 = Flatten[Table[Position[f, -n], {n, 0, z}]];
%t A226130 Union[p1, p2]  (* A226137 *)  (* _Peter J. C. Moses_, May 26 2013 *)
%o A226130 (Python)
%o A226130 from fractions import Fraction
%o A226130 from itertools import count, islice
%o A226130 def agen():
%o A226130     rats = [Fraction(1, 1)]
%o A226130     seen = {Fraction(1, 1)}
%o A226130     for n in count(1):
%o A226130         yield from [r.denominator for r in rats]
%o A226130         newrats = []
%o A226130         for r in rats:
%o A226130             f = 1+r
%o A226130             if f not in seen:
%o A226130                 newrats.append(1+r)
%o A226130                 seen.add(f)
%o A226130             if r != 0:
%o A226130                 g = -1/r
%o A226130                 if g not in seen:
%o A226130                     newrats.append(-1/r)
%o A226130                     seen.add(g)
%o A226130         rats = newrats
%o A226130 print(list(islice(agen(), 84))) # _Michael S. Branicky_, Jan 17 2022
%Y A226130 Cf. A226080 (rabbit ordering of positive rationals).
%Y A226130 Cf. A226130, A226131, A226136, A226137, A226275.
%Y A226130 Cf. A226247 (analogous with "0 is in S").
%K A226130 nonn,frac,tabf
%O A226130 1,5
%A A226130 _Clark Kimberling_, May 28 2013