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.

Showing 1-9 of 9 results.

A226249 Positions of nonpositive numbers in the ordering of the rational numbers at A226247.

Original entry on oeis.org

2, 3, 5, 7, 9, 10, 12, 13, 15, 17, 18, 20, 22, 24, 25, 27, 29, 31, 32, 34, 35, 37, 39, 41, 42, 44, 45, 47, 49, 50, 52, 54, 56, 57, 59, 60, 62, 64, 65, 67, 69, 71, 72, 74, 76, 78, 79, 81, 82, 84, 86, 87, 89, 91, 93, 94, 96, 98, 100, 101, 103, 104, 106, 108
Offset: 1

Views

Author

Clark Kimberling, Jun 01 2013

Keywords

Comments

The rational numbers are ordered as a sequence S'' described at A226247.

Examples

			The positions 1,2,3,5,6,8,9,11,12,... are read from this ordering:
0/1, 1/1, 2/1, -1/1, 3, -1/2, 4/1, -1/3, 1/2, 5, -1/4, 2/3, 3/2, -2, ...
		

Crossrefs

Programs

Formula

a(n) = A005374(n) + n. - Alan Michael Gómez Calderón, Jul 16 2025

A226250 Positions of positive numbers in the ordering of the rational numbers at A226247.

Original entry on oeis.org

1, 4, 6, 8, 11, 14, 16, 19, 21, 23, 26, 28, 30, 33, 36, 38, 40, 43, 46, 48, 51, 53, 55, 58, 61, 63, 66, 68, 70, 73, 75, 77, 80, 83, 85, 88, 90, 92, 95, 97, 99, 102, 105, 107, 109, 112, 115, 117, 120, 122, 124, 127, 129, 131, 134, 137, 139, 141, 144, 147, 149
Offset: 1

Views

Author

Clark Kimberling, Jun 01 2013

Keywords

Comments

The rational numbers are ordered as a sequence S'' described at A226247.

Examples

			The positions 1,2,3,5,6,8,9,11,12,... are read from this ordering:
0/1, 1/1, 2/1, -1/1, 3, -1/2, 4/1, -1/3, 1/2, 5, -1/4, 2/3, 3/2, -2, ...
		

Crossrefs

Cf. A226247.

Programs

A226324 Array by antidiagonals: D(m,n) = distance between m and n using the graph-metric of A226247.

Original entry on oeis.org

0, 1, 1, 2, 0, 2, 2, 1, 1, 2, 3, 1, 0, 1, 3, 3, 2, 2, 2, 2, 3, 4, 2, 1, 0, 1, 2, 4, 4, 3, 1, 3, 3, 1, 3, 4, 4, 3, 2, 3, 0, 3, 2, 3, 4, 5, 3, 2, 4, 2, 2, 4, 2, 3, 5, 5, 4, 2, 4, 1, 0, 1, 4, 2, 4, 5, 5, 4, 3, 4, 1, 3, 3, 1, 4, 3, 4, 5, 5, 4, 3, 5, 3, 3, 0, 3
Offset: 1

Views

Author

Clark Kimberling, Jun 04 2013

Keywords

Comments

Let S be the set of numbers defined by these rules: 0 is in S; if x is in S, then x+1 is in S, and if nonzero x is in S, then -1/x is in S. Then S is the set of all rational numbers, produced in generations as follows:
g(1) = (0), g(2) = (1), g(3) = (2, -1), g(4) = (3, -1/2), g(5) = (4,-1/3,1/2),... For n > 2, 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. This order of generation matches a tree with (0,1), (1,2), (1,-1), (2,3), (2,-1/2), (3,4), (4,-1/3), (-1/2,1/2), etc. Replace each node by the order in which it is generated, so that the nodes labeled (0,1,2,-1,3,-1/2,4,-1/3,...) get new labels (1,2,3,4,5,6,...), respectively. If m and n are positive integers, then D(m,n) is the number of edges between m and n.

Examples

			Northwest corner of the distance table:
0 1 2 2 3 3 4 4 4 5
1 0 1 1 2 2 3 3 3 4
2 1 0 2 1 1 2 2 2 3
2 1 2 0 3 3 4 4 4 5
3 2 1 3 0 2 1 1 3 2
3 2 1 3 2 0 3 3 1 4
4 3 2 4 1 3 0 2 4 1
4 3 2 4 1 3 2 0 4 3
4 3 2 4 3 1 4 4 0 5
5 4 3 5 2 4 1 3 5 0
Row 5, column 4 is occupied by 3, meaning that D(5,4) = 3, a count of edges in the subgraph 5 -> 3 -> 2 -> 4.
		

Crossrefs

Programs

  • Mathematica
    $MaxExtraPrecision = Infinity; g[1] := {1}; g[2] := {1, 0}; g[3] := {1, 0, 0}; g[test_] := Module[{topRow, len, tmp = test, noOfTerms = Ceiling[Log[test]/Log[1.465571231876768026656731]] - 1}, topRow = Flatten[{1, LinearRecurrence[{1, 0, 1}, {2, 3, 5}, noOfTerms]}]; If[First[#] == 0, Rest[#], #] &[Table[If[# >= 0, tmp = #; 1, 0] &[tmp - topRow[[n]]], {n, noOfTerms, 1, -1}]]]; d[n1_, n2_] := Module[{z1 = g[n1], z2 = g[n2]}, Length[z1] + Length[z2] - 2(NestWhile[# + 1 &, 1, z1[[#]] == z2[[#]] &, 1, Min[{Length[z1], Length[z2]}]] - 1)]; (dArray = Table[d[m, n], {m, 1, #}, {n, 1, #}] &[15]) // TableForm
      Flatten[Table[d[k, n + 1 - k], {n, 1, 15}, {k, 1, n}]]
      ArrayPlot[dArray, ColorFunction -> "BlueGreenYellow"]
    (* Peter J. C. Moses, Jun 02 2013 *)

A226080 Denominators in the Fibonacci (or rabbit) ordering of the positive rational numbers.

Original entry on oeis.org

1, 1, 1, 2, 1, 3, 2, 1, 4, 3, 2, 3, 1, 5, 4, 3, 4, 2, 5, 3, 1, 6, 5, 4, 5, 3, 7, 4, 2, 7, 5, 3, 5, 1, 7, 6, 5, 6, 4, 9, 5, 3, 10, 7, 4, 7, 2, 9, 7, 5, 7, 3, 8, 5, 1, 8, 7, 6, 7, 5, 11, 6, 4, 13, 9, 5, 9, 3, 13, 10, 7, 10, 4, 11, 7, 2, 11, 9, 7, 9, 5, 12, 7
Offset: 1

Views

Author

Clark Kimberling, May 25 2013

Keywords

Comments

Let S be the set of numbers defined by these rules: 1 is in S, and if x is in S, then x+1 and 1/x are in S. Then S is the set of positive rational numbers, which arise in generations as follows: g(1) = (1/1), g(2) = (1+1) = (2), g(3) = (2+1, 1/2) = (3/1, 1/2), g(4) = (4/1, 1/3, 3/2), ... . Once g(n-1) = (g(1), ..., g(z)) is defined, g(n) is formed from the vector (g(1) + 1, 1/g(1), g(2) + 1, 1/g(2), ..., g(z) + 1, 1/g(z)) by deleting all elements that are in a previous generation. A226080 is the sequence of denominators formed by concatenating the generations g(1), g(2), g(3), ... . It is easy to prove the following:
(1) Every positive rational is in S.
(2) The number of terms in g(n) is the n-th Fibonacci number, F(n) = A000045(n).
(3) For n > 2, g(n) consists of F(n-2) numbers < 1 and F(n-1) numbers > 1, hence the name "rabbit ordering" since the n-th generation has F(n-2) reproducing pairs and F(n-1) non-reproducing pairs, as in the classical rabbit-reproduction introduction to Fibonacci numbers.
(4) The positions of integers in S are the Fibonacci numbers.
(5) The positions of 1/2, 3/2, 5/2, ..., are Lucas numbers (A000032).
(6) Continuing from (4) and (5), suppose that n > 0 and 0 < r < n, where gcd(n,r) = 1. The positions in A226080 of the numbers congruent to r mod n comprise a row of the Wythoff array, W = A035513. The correspondence is sampled here:
row 1 of W: positions of n+1 for n>=0,
row 2 of W: positions of n+1/2,
row 3 of W: positions of n+1/3,
row 4 of W: positions of n+1/4,
row 5 of W: positions of n+2/3,
row 6 of W: positions of n+1/5,
row 7 of W: positions of n+3/4.
(7) If the numbers <=1 in S are replaced by 1 and those >1 by 0, the resulting sequence is the infinite Fibonacci word A003849 (except for the 0-offset first term).
(8) The numbers <=1 in S occupy positions -1 + A001950, where A001950 is the upper Wythoff sequence; those > 1 occupy positions given by -1 + A000201, where A000201 is the lower Wythoff sequence.
(9) The rules (1 is in S, and if x is in S, then 1/x and 1/(x+1) are in S) also generate all the positive rationals.
A variant which extends this idea to an ordering of all rationals is described in A226130. - M. F. Hasler, Jun 03 2013
The updown and downup zigzag limits are (-1 + sqrt(5))/2 and (1 + sqrt(5))/2; see A020651. - Clark Kimberling, Nov 10 2013
From Clark Kimberling, Jun 19 2014: (Start)
Following is a guide to related trees and sequences; for example, the tree A226080 is represented by (1, x+1, 1/x), meaning that 1 is in S, and if x is in S, then x+1 and 1/x are in S (except for x = 0).
All the positive integers:
A243571, A243572, A232559 (1, x+1, 2x)
A232561, A242365, A243572 (1, x+1, 3x)
A243573 (1, x+1, 4x)
All the integers:
A243610 (1, 2x, 1-x)
All the positive rationals:
A226080, A226081, A242359, A242360 (1, x+1, 1/x)
A243848, A243849, A243850 (1, x+1, 2/x)
A243851, A243852, A243853 (1, x+1, 3/x)
A243854, A243855, A243856 (1, x+1, 4/x)
A243574, A242308 (1, 1/x, 1/(x+1))
A241837, A243575 ({1,2,3}, x+4, 12/x)
A242361, A242363 (1, 1 + 1/x, 1/x)
A243613, A243614 (0, x+1, x/(x+1))
All the rationals:
A243611, A243612 (0, x+1, -1/(x+1))
A226130, A226131 (1, x+1, -1/x)
A243712, A243713 ({1,2,3}, x+1, 1/(x+1))
A243730, A243731 ({1,2,3,4}, x+1, 1/(x+1))
A243732, A243733 ({1,2,3,4,5}, x+1, 1/(x+1))
A243925, A243926, A243927 (1, x+1, -2/x)
A243928, A243929, A243930 (1, x+1, -3/x)
All the Gaussian integers:
A243924 (1, x+1, i*x)
All the Gaussian rational numbers:
A233694, A233695, A233696 (1, x+1, i*x, 1/x).
(End)

Examples

			The denominators are read from the rationals listed in "rabbit order":
1/1, 2/1, 3/1, 1/2, 4/1, 1/3, 3/2, 5/1, 1/4, 4/3, 5/2, 2/3, 6/1, ...
		

Crossrefs

Cf. A000045, A035513, A226081 (numerators), A226130, A226247, A020651.

Programs

  • Mathematica
    z = 10; g[1] = {1}; g[2] = {2}; g[3] = {3, 1/2};
    j[3] = Join[g[1], g[2], g[3]]; j[n_] := Join[j[n - 1], g[n]];
    d[s_List, t_List] := Part[s, Sort[Flatten[Map[Position[s, #] &, Complement[s, t]]]]]; j[3] = Join[g[1], g[2], g[3]]; n = 3; While[n <= z, n++; g[n] = d[Riffle[g[n - 1] + 1, 1/g[n - 1]], g[n - 2]]];
    Table[g[n], {n, 1, z}]; j[z] (* rabbit-ordered rationals *)
    Denominator[j[z]]  (* A226080 *)
    Numerator[j[z]]    (* A226081 *)
    Flatten[NestList[(# /. x_ /; x > 1 -> Sequence[x, 1/x - 1]) + 1 &, {1}, 9]] (* rabbit-ordered rationals, Danny Marmer, Dec 07 2014 *)
  • PARI
    A226080_vec(N=100)={my(T=[1],S=T,A=T); while(N>#A=concat(A, apply(denominator, T=select(t->!setsearch(S,t), concat(apply(t->[t+1,1/t],T))))), S=setunion(S,Set(T)));A} \\ M. F. Hasler, Nov 30 2018
    
  • PARI
    (A226080(n)=denominator(RabbitOrderedRational(n))); ROR=List(1); RabbitOrderedRational(n)={if(n>#ROR, local(S=Set(ROR), i=#ROR*2\/(sqrt(5)+1), a(t)=setsearch(S,t)||S=setunion(S,[listput(ROR,t)])); until( type(ROR[i+=1])=="t_INT" && n<=#ROR, a(ROR[i]+1); a(1/ROR[i])));ROR[n]} \\ M. F. Hasler, Nov 30 2018

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

Original entry on oeis.org

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, 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, 4, 1, 9, 8, 7, 6, 6, 11, 5, 14, 9, 4, 15, 11, 7, 3, 3
Offset: 1

Views

Author

Clark Kimberling, May 28 2013

Keywords

Comments

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.
A226130: Denominators of terms of S'
A226131: Numerators of terms of S'
A226136: Positions of positive integers in S'
A226137: Positions of integers in S'
The length of row n is given by A226275(n-1). - Peter Kagey, Jan 17 2022

Examples

			The denominators and numerators are read from the rationals in S':
  1/1, 2/1, -1/1, 3/1, -1/2, 0/1, 4/1, -1/3, 1/2, ...
Table begins:
  n |
  --+-----------------------------------------------
  1 | 1;
  2 | 1, 1;
  3 | 1, 2, 1;
  4 | 1, 3, 2;
  5 | 1, 4, 3, 2, 1;
  6 | 1, 5, 4, 3, 2, 2, 3;
  7 | 1, 6, 5, 4, 3, 3, 5, 2, 5, 3;
  8 | 1, 7, 6, 5, 4, 4, 7, 3, 8, 5, 2, 7, 5, 3, 1;
		

Crossrefs

Cf. A226080 (rabbit ordering of positive rationals).
Cf. A226247 (analogous with "0 is in S").

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 *)
  • Python
    from fractions import Fraction
    from itertools import count, islice
    def agen():
        rats = [Fraction(1, 1)]
        seen = {Fraction(1, 1)}
        for n in count(1):
            yield from [r.denominator for r in rats]
            newrats = []
            for r in rats:
                f = 1+r
                if f not in seen:
                    newrats.append(1+r)
                    seen.add(f)
                if r != 0:
                    g = -1/r
                    if g not in seen:
                        newrats.append(-1/r)
                        seen.add(g)
            rats = newrats
    print(list(islice(agen(), 84))) # Michael S. Branicky, Jan 17 2022

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

Original entry on oeis.org

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

Views

Author

Clark Kimberling, May 28 2013

Keywords

Comments

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.
A226130: Denominators of terms of S'
A226131: Numerators of terms of S'
A226136: Positions of positive integers in S'
A226137: Positions of integers in S'

Examples

			Rationals in S': 1/1, 2/1, -1/1, 3/1, -1/2, 0/1, 4/1, -1/3, 1/2, ...
		

Crossrefs

Cf. A226080 (rabbit ordering of positive rationals), A226247.

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

A226248 Numerators of rational numbers as generated by the rules: 0 is in S; if x is in S, then x+1 is in S, and if nonzero x is in S, then -1/x are in S.

Original entry on oeis.org

0, 1, 2, -1, 3, -1, 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

Views

Author

Clark Kimberling, Jun 01 2013

Keywords

Comments

The rational numbers are ordered as a sequence S'' described at A226247.

Examples

			The denominators and numerators are read from S'':
0/1, 1/1, 2/1, -1/1, 3, -1/2, 4/1, -1/3, 1/2, 5, -1/4, 2/3, 3/2, -2, ...
		

Crossrefs

Cf. A226247.

Programs

A226456 Array by antidiagonals: D(m,n) = binary distance between m and n.

Original entry on oeis.org

0, 1, 1, 1, 0, 1, 2, 2, 2, 2, 2, 1, 0, 1, 2, 2, 1, 3, 3, 1, 2, 2, 3, 3, 0, 3, 3, 2, 3, 3, 1, 2, 2, 1, 3, 3, 3, 2, 1, 4, 0, 4, 1, 2, 3, 3, 2, 4, 4, 4, 4, 4, 4, 2, 3, 3, 2, 4, 1, 4, 0, 4, 1, 4, 2, 3, 3, 2, 4, 1, 3, 2, 2, 3, 1, 4, 2, 3, 3, 4, 4, 3, 3, 5, 0, 5
Offset: 1

Views

Author

Clark Kimberling, Jun 08 2013

Keywords

Comments

Method 1. In base 2, write m = m(0) + m(1)*2 + ... + m(i)*2^i and n = n(0) + n(1)*2 + ... + n(j)*2^j. Let c be the greatest h such that m(h) = n(h) for h = 0,...,c, and let r(m,n) = m(0) + m(1)*2 + ... + m(c)*2^c. For every positive integer k, let g(k) be the number of binary digits of k. Then D(m,n) = g(m) + g(n) - 2*g(r(m,n)).
Method 2. Let S be the set determined by these rules: 1 is in S, and if x is in S, then x+1 and 1/(x+1) are in S. As in A226080, grow the tree from the root 1, and then replace each number by the order in which it was generated. In the resulting tree, D(m,n) is the number of edges from m to n; i.e., D is the graph metric of the tree. The tree is also determined by the condition that if m < n, then m and n are connected by an edge if and only if m = floor(n/2).
The set S consists of all the positive rationals, of which the first 15 are indicated in generations by (1), (2, 1/2), (3 ,1/3, 3/2, 2/3), (4, 1/4, 4/3, 3/4, 5/2, 2/5, 5/3, 3/5). One outermost branch of the tree consists of 1,2,3,4,... and the other involves Fibonacci numbers: 1, 1/2, 2/3, 3/5,...
D(n,1)+1 is the number of digits in (n base 2); D(n,n+1) = A101688(n) for n>=1.

Examples

			Northwest corner of the distance table:
0 1 1 2 2 2 2 3 3 3
1 0 2 1 1 3 3 2 2 2
1 2 0 3 3 1 1 4 4 4
2 1 3 0 2 4 4 1 1 3
2 1 3 2 0 4 4 3 3 1
2 3 1 4 4 0 2 5 5 5
2 3 1 4 4 2 0 5 5 5
3 2 4 1 3 5 5 0 2 4
3 2 4 1 3 5 5 2 0 4
3 2 4 3 1 5 5 4 4 0
Row 9, column 6 is occupied by 5, meaning that D(9,6) = 5, a count of edges in the subgraph 9 -> 4 -> 2 -> 1 -> 3 ->6.
		

Crossrefs

Programs

  • Mathematica
    r = 1/2; f[x_] := Floor[r*x]; z = 20; g[x_] := FixedPointList[f, x]; u[x_] := Length[g[x]];  v[x_, y_] := Max[Intersection[g[x], g[y]]]; d[x_, y_] := u[x] + u[y] - 2*Length[g[v[x, y]]]; TableForm[Table[d[m, n], {m, 1, z}, {n, 1, z}]] (* A226456 array *)
    Flatten[Table[d[k, n + 1 - k], {n, 1, z}, {k, 1, n}]] (* A226456 sequence *)
    Table[d[n, n + 1], {n, 1, 100}] (* A101688 *)
    Table[d[n, 2^n], {n, 1, 100}]   (* A226457 *)

A350391 The largest denominator that can be made from n repeated applications of the maps f(x) = x + 1 or g(x) = -1/x, starting from 0.

Original entry on oeis.org

1, 1, 1, 2, 3, 4, 5, 6, 8, 11, 15, 19, 24, 30, 41, 56, 72, 91, 115, 153, 209, 269, 345, 436, 571, 780, 1005, 1292, 1653, 2131, 2911, 3751, 4827, 6191, 7953, 10864, 14000, 18034, 23184, 29681, 40545, 52249, 67320, 86617, 111097, 151316, 194997
Offset: 0

Views

Author

Peter Kagey, Jan 10 2022

Keywords

Comments

Every rational number can be generated by repeated applications of the maps f(x) = x + 1 and g(x) = -1/x.
For n > 0, a(n) is the maximum entry in row n of A226247.

Examples

			For n = 0, a(0) = 1 because  0/1 = 0.
For n = 1, a(1) = 1 because  1/1 = f(0).
For n = 2, a(2) = 1 because  2/1 = f(f(0)).
For n = 3, a(3) = 2 because -1/2 = g(f(f(0))).
For n = 4, a(4) = 3 because -1/3 = g(f(f(f(0)))).
For n = 5, a(5) = 4 because -1/4 = g(f(f(f(f(0))))).
For n = 6, a(6) = 5 because -1/5 = g(f(f(f(f(f(0)))))).
For n = 7, a(7) = 6 because -1/6 = g(f(f(f(f(f(f(0))))))).
For n = 8, a(8) = 8 because -3/8 = g(f(f(f(g(f(f(f(0)))))))).
		

Crossrefs

Programs

  • Python
    from fractions import Fraction
    from itertools import count, islice
    def agen():
        rats = {Fraction(0, 1)}
        for n in count(1):
            yield max(r.denominator for r in rats)
            newrats = set()
            for r in rats:
                newrats.add(1+r)
                if r != 0:
                    newrats.add(-1/r)
            rats = newrats
    print(list(islice(agen(), 25))) # Michael S. Branicky, Jan 17 2022

Extensions

a(42)-a(46) from Michael S. Branicky, Jan 17 2022
Showing 1-9 of 9 results.