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-10 of 15 results. Next

A226274 Position of 1/n in the ordering of the rationals given by application of the map t -> (1+t,-1/t), cf. A226130.

Original entry on oeis.org

1, 9, 31, 100, 317, 1000, 3150, 9918, 31223, 98289, 309406, 973981, 3065996, 9651448, 30381786, 95638797, 301061279, 947710512, 2983297009, 9391117780, 29562290606, 93059106094, 292940670339, 922147653681, 2902827709802, 9137808548505, 28764898718296, 90548996937472
Offset: 1

Views

Author

M. F. Hasler, Jun 01 2013

Keywords

Comments

An analog of the Fibonacci ordering of the positive rationals (cf. A226080) is the sequence of rationals produced from the initial vector [1] by appending iteratively the new rationals obtained by applying the map t-> (t+1, -1/t) to each term of the vector (cf. example).
It is seen that the unit fraction 1/n appears as the last term produced in the (3n-3)th iteration, therefore the indices a(n) equal every third terms in the partial sums of A226275 (= new terms produced during the respective iteration), cf. formula.

Examples

			Starting with [1], applying the map t->(1+t,-1/t) to the (most recently obtained) vector and discarding the numbers occurring earlier, one gets the sequence (grouped by "generation"): [1], [2, -1], [3, -1/2, 0], [4, -1/3, 1/2], [5, -1/4, 2/3, 3/2, -2], [6, -1/5, 3/4, 5/3, -3/2, 5/2, -2/3], [7, -1/6, 4/5, 7/4, -4/3, 8/3, -3/5, 7/2, -2/5, 1/3], [8, -1/7, 5/6, 9/5, -5/4, 11/4, -4/7, 11/3, -3/8, 2/5, 9/2, -2/7, 3/5, 4/3, -3],...
The unit fractions 1/1, 1/2, 1/3, 1/4,... occur at positions 1, 9(=1+2+3+3), 31(=9+5+7+10), 100(=31+15+22+32), ...
		

Crossrefs

Programs

  • PARI
    {print1([s=1]", ");U=Set(g=[1]); for(n=1,29,U=setunion(U,Set(g=select(f->!setsearch(U,f), concat(apply(t->[t+1,if(t,-1/t)],g))))); for(i=1,#g, numerator(g[i])==1&&print1(s+i/*",g[i],*/","));s+=#g)} /* illustrative purpose only */

Formula

a(n) = s(3n-3) where s(k) = Sum_{j=0..k} A226275(j).
O.g.f.: x(1 + 4*x - 7*x^2 + 4*x^3 - x^4)/((1 - x)(1 - 4*x + 3*x^2 - x^3)).

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

A232559 Sequence (or tree) generated by these rules: 1 is in S, and if x is in S, then x + 1 and 2*x are in S, and duplicates are deleted as they occur.

Original entry on oeis.org

1, 2, 3, 4, 6, 5, 8, 7, 12, 10, 9, 16, 14, 13, 24, 11, 20, 18, 17, 32, 15, 28, 26, 25, 48, 22, 21, 40, 19, 36, 34, 33, 64, 30, 29, 56, 27, 52, 50, 49, 96, 23, 44, 42, 41, 80, 38, 37, 72, 35, 68, 66, 65, 128, 31, 60, 58, 57, 112, 54, 53, 104, 51, 100, 98, 97
Offset: 1

Views

Author

Clark Kimberling, Nov 26 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 2*x are in S. Then S is the set of all positive integers, which arise in generations. Deleting duplicates as they occur, the generations are given by g(1) = (1), g(2) = (2), g(3) = (3,4), g(4) = (6,5,8), g(5) = (7,12,10,9,16), etc. Concatenating these gives A232559, a permutation of the positive integers. The number of numbers in g(n) is A000045(n), the n-th Fibonacci number. It is helpful to show the results as a tree with the terms of S as nodes and edges from x to x + 1 if x + 1 has not already occurred, and an edge from x to 2*x if 2*x has not already occurred. The positions of the odd numbers are given by A026352, and of the evens, by A026351.
The previously mentioned tree is an example of a fractal tree; that is, an infinite rooted tree T such that every complete subtree of T contains a subtree isomorphic to T. - Clark Kimberling, Jun 11 2016
The similar sequence S', generated by these rules: 0 is in S', and if x is in S', then 2*x and x+1 are in S', and duplicates are deleted as they occur, appears to equal A048679. - Rémy Sigrist, Aug 05 2017
From Katherine E. Stange and Glen Whitney, Oct 09 2021: (Start)
The beginning of this tree is
1
|
2
/ \
3..../ \......4
| / \
6 5.../ \...8
/ \ | / \
7/ \12 10 9/ \16
This tree contains every positive integer, and one can show that the path from 1 to the integer n is exactly the sequence of intermediate values observed during the Double-And-Add Algorithm AKA Chandra Sutra Method (namely, the algorithm which begins with m = 0, reads the binary representation of n from left to right, and, for each digit 0 read, doubles m, and for each digit 1 read, doubles m and then adds 1 to m; when the algorithm terminates, m = n).
As such, the path between 1 and n is a function of the binary expansion of n. The elements of the k-th row of the tree (generation g(k)) are all those elements whose binary expansion has k_1 digits and Hamming weight k_2, for some k_1 and k_2 such that k_1 + k_2 = k + 1.
The depth at which integer n appears in this tree is given by A014701(n) = A056792(n)-1. For example, the depth of 1 is 0, the depth of 2 is 1, and the depths of 3 and 4 are both 2. (End)
Definition need not invoke deletion: Tree is rooted at 1, all even nodes have x+1 as a child, all nodes have 2*x as a child, and any x+1 child precedes its sibling. - Robert Munafo, May 08 2024

Examples

			Each x begets x + 1 and 2*x, but if either has already occurred it is deleted.  Thus, 1 begets 2, which begets (3,4); from which 3 begets only 6, and 4 begets (5,8).
		

Crossrefs

Cf. A232560 (inverse permutation), A232561, A232563, A226080, A226130.
Cf. A243571 (rows sorted).

Programs

  • Maple
    a:= proc() local l, s; l, s:= [1], {1}:
          proc(n) option remember; local i, r; r:= l[1];
            l:= subsop(1=NULL, l);
            for i in [1+r, r+r] do if not i in s then
              l, s:=[l[], i], s union {i} fi
            od; r
          end
        end():
    seq(a(n), n=1..100);  # Alois P. Heinz, Aug 06 2017
  • Mathematica
    z = 12; g[1] = {1}; g[2] = {2}; g[n_] := Riffle[g[n - 1] + 1, 2 g[n - 1]]; j[2] = Join[g[1], g[2]]; j[n_] := Join[j[n - 1], g[n]]; g1[n_] := DeleteDuplicates[DeleteCases[g[n], Alternatives @@ j[n - 1]]]; g1[1] = g[1]; g1[2] = g[2]; t = Flatten[Table[g1[n], {n, 1, z}]]  (* this sequence *)
    Table[Length[g1[n]], {n, 1, z}] (* Fibonacci numbers *)
    t1 = Flatten[Table[Position[t, n], {n, 1, 200}]]  (* A232560 *)
  • Python
    def aupton(terms):
        alst, S, expand = [1, 2], {1, 2}, [2]
        while len(alst) < terms:
            x = expand.pop(0)
            new_elts = [y for y in [x+1, 2*x] if y not in S]
            alst.extend(new_elts); expand.extend(new_elts); S.update(new_elts)
        return alst[:terms]
    print(aupton(66)) # Michael S. Branicky, Sep 14 2021

Formula

Conjecture: a(n) = A059894(A348366(n)) for n > 0. - Mikhail Kurkov, Jun 14 2022

A020651 Denominators in recursive bijection from positive integers to positive rationals (the bijection is f(1) = 1, f(2n) = f(n)+1, f(2n+1) = 1/(f(n)+1)).

Original entry on oeis.org

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

Views

Author

Keywords

Comments

If we insert an initial 1, this is the sequence of numerators in left-hand half of Kepler's tree of fractions. Form a tree of fractions by beginning with 1/1 and then giving every node i/j two descendants labeled i/(i+j) and j/(i+j). See A086592 for denominators. See A294442 for the Kepler tree itself.
Level n of the tree consists of 2^n nodes: 1/2; 1/3, 2/3; 1/4, 3/4, 2/5, 3/5; 1 /5, 4/5, 3/7, 4/7, 2/7, 5/7, 3/8, 5/8; ... Fibonacci numbers occur at the right edge this tree, i.e., a(A000225(n)) = A000045(n+1). The fractions are given in their reduced form, thus gcd(A020650(n), A020651(n)) = 1 and gcd(A020651(n), A086592(n)) = 1 for all n. - Antti Karttunen, May 26 2004
A generalization which includes the "rabbit tree" (A226080) and "all rationals tree" (A226130) follows. Suppose that a,b,c,d,e,f,g,h are complex numbers. Let S be the set of numbers defined by these rules: (1) 1 is in S; (2) if x is in S and cx+d is not 0, then U(x) = (ax+b)/(cx+d) is in S; (3) if x is in S and gx+h is not 0, then D(x) = (ex+f)/(gx+h) is in S. If an infinite path in the resulting tree has convergent nodes, then there is some node after which the path is "updown zigzag" ((UoD)o(UoD)o ...) or "downup zigzag" (DoU)o(DoU)o ...). If ag+ch is not 0, then the updown zigzag limit is invariant of x and equals [ae + cf - bg - dh + sqrt(X)]/(2(ag + ch)), where X = (ae + cf - bg - dh)^2 + 4(be + df + ag + ch). If ce + dg is not 0, then the downup zigzag limit is invariant of x and equals [ae + bg - cf - dh + sqrt(Y)]/(2(ce + dg)), where Y = (ae + bg - cf - dh)^2 + 4(af + bh)(ce + dg)) = X. Thus, for the tree A020651, the updown zigzag limit is -1 + sqrt(2) and the downup zigzag limit, sqrt(2). - Clark Kimberling, Nov 10 2013
From Yosu Yurramendi, Jul 13 2014: (Start)
If the terms (n > 0) are written as an array (left-aligned fashion) with rows of length 2^m, m = 0,1,2,3,...
1,
1,2,
1,3,2,3,
1,4,3,4,2,5,3,5,
1,5,4,5,3,7,4,7,2, 7,5, 7,3, 8,5, 8,
1,6,5,6,4,9,5,9,3,10,7,10,4,11,7,11,2,9,7,9,5,12,7,12,3,11,8,11,5,13,8,13,
then the sum of the m-th row is 3^m (m = 0,1,2,), and each column is an arithmetic sequence. The differences of the arithmetic sequences, except the first on the left, give the sequence A093873 (Numerators in Kepler's tree of harmonic fractions) (a(2^(m+1)-1-k) - a(2^m-1-k) = A093873(k), m = 0,1,2,..., k = 0,1,2,...,2^m-1).
If the rows are written in a right-aligned fashion:
1,
1, 2,
1, 3,2, 3,
1, 4,3, 4,2, 5,3, 5,
1,5,4,5,3, 7,4, 7,2, 7,5, 7,3, 8,5, 8,
1,6,5,6,4,9,5,9,3,10,7,10,4,11,7,11,2,9,7,9,5,12,7,12,3,11,8,11,5,13,8,13,
then each column k is a Fibonacci sequence. (End)
For m >= 0, a(2^m) = 1 and a(3*2^m) = 2. For n >= 0, a(A070875(n)) = 3 (for m >= 0, a(5*2^m) = 3 and a(7*2^m) = 3). - Yosu Yurramendi, Jun 02 2016

Examples

			1, 2, 1/2, 3, 1/3, 3/2, 2/3, 4, 1/4, 4/3, ...
		

Crossrefs

See A294442 and A093873/A093875 for two different versions of the Kepler tree.

Programs

  • Haskell
    import Data.List (transpose); import Data.Ratio (denominator)
    a020651_list = map denominator ks where
       ks = 1 : concat (transpose [map (+ 1) ks, map (recip . (+ 1)) ks])
    -- Reinhard Zumkeller, Feb 22 2014
    
  • Maple
    A020651 := n -> `if`((n < 2),n,`if`(type(n,even), A020651(n/2), A020650(n-1)));
  • Mathematica
    f[1] = 1; f[n_?EvenQ] := f[n] = f[n/2]+1; f[n_?OddQ] := f[n] = 1/(f[(n-1)/2]+1); a[n_] := Denominator[f[n]]; Table[a[n], {n, 1, 94}] (* Jean-François Alcover, Nov 22 2011 *)
  • R
    N <- 25 # arbitrary
    a <- c(1,1,2)
    for(n in 1:N){
      a[4*n]   <- a[2*n]
      a[4*n+1] <- a[2*n] + a[2*n+1]
      a[4*n+2] <-          a[2*n+1]
      a[4*n+3] <- a[2*n] + a[2*n+1]
    }
    a
    # Yosu Yurramendi, Jul 13 2014

Formula

a(1) = 1, a(2n) = a(n), a(2n+1) = A020650(2n). - Antti Karttunen, May 26 2004
a(2n) = A020650(2n+1). - Yosu Yurramendi, Jul 17 2014
a(2^m + k) = A093873(2^(m+1) + k) = A093873(2^(m+1) + 2^m + k), m >= 0, 0 <= k < 2^m. - Yosu Yurramendi, May 18 2016
a(2^m + 2^r + k) = A093873(2^r + k)*(m-(r-1)) + A093873(k), m >= 0, r <= m-1, 0 <= k < 2^r. For k=0 A093873(0) = 0 is needed. - Yosu Yurramendi, Jul 30 2016
a((2n+1)*2^m) = A086592(n), m >= 0, n > 0. For n = 0 A086592(0) = 1 is needed. - Yosu Yurramendi, Feb 14 2017
a(4n+2) = a(4n+1) - a(4n) = a(2n+1) = a(4n+1) - a(n), n > 0. - Yosu Yurramendi, May 08 2018
a(1) = 1, a(n+1) = 2*floor(1/a(n))+1-1/a(n). - Jan Malý, Jul 30 2019
a(n) = A002487(A231551(n)), n > 0. - Yosu Yurramendi, Jul 15 2021

Extensions

Entry revised by N. J. A. Sloane, May 24 2004

A226247 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 are in S. (See Comments.)

Original entry on oeis.org

1, 1, 1, 1, 1, 2, 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, Jun 01 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 are 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.
Let S'' denote the sequence formed by concatenating the generations.
A226247: Denominators of terms of S''
A226248: Numerators of terms of S''
A226249: Positions of nonnegative numbers in S''
A226250: Positions of positive numbers in S''
A closely related sequence S' (for which the rules of generation are shorter but the resulting sequence is slightly less natural) is discussed at A226130. For both S' and S'', the number of numbers in g(n) is given by A097333.

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, ...
Table begins:
  n |
  --+-----------------------------------------------
  1 | 1;
  2 | 1;
  3 | 1, 1;
  4 | 1, 2;
  5 | 1, 3, 2;
  6 | 1, 4, 3, 2, 1;
  7 | 1, 5, 4, 3, 2, 2, 3;
  8 | 1, 6, 5, 4, 3, 3, 5, 2, 5, 3;
  9 | 1, 7, 6, 5, 4, 4, 7, 3, 8, 5, 2, 7, 5, 3, 1;
		

Crossrefs

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

Programs

  • Mathematica
    z = 12; g[1] := {0}; g[2] := {1}; g[n_] :=  g[n] = DeleteCases[Flatten[Transpose[{# + 1, -1/#}]] &[g[n - 1]], Apply[Alternatives, Flatten[Map[g, Range[n - 1]]]]]; f = Flatten[Map[g, Range[z]]]; Take[Denominator[f], 100]  (*A226247*)
    t = Take[Numerator[f], 100]  (*A226248*)
    s[n_] := If[t[[n]] > 0, 1, 0]; u = Table[s[n], {n, 1, Length[t]}]
    Flatten[Position[u, 1]] (*A226249*)
    p = Flatten[Position[u, 0]] (*A226250*) (* Peter J. C. Moses, May 30 2013 *)
  • Python
    from fractions import Fraction
    from itertools import count, islice
    def agen():
        rats = [Fraction(0, 1)]
        seen = {Fraction(0, 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 *)

A226136 Positions of the positive integers in the ordering 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, 4, 7, 10, 15, 22, 32, 47, 69, 101, 148, 217, 318, 466, 683, 1001, 1467, 2150, 3151, 4618, 6768, 9919, 14537, 21305, 31224, 45761, 67066, 98290, 144051, 211117, 309407, 453458, 664575, 973982
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

			S' = (1/1, 2/1, -1/1, 3/1, -1/2, 0/1, 4/1, -1/3, 1/2, ...), with positive integers appearing in positions 1,2,4,7,...
		

Crossrefs

Cf. A226080 (rabbit ordering of positive rationals).

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

Formula

Conjecture: a(n) = a(n-1)+a(n-3) for n>6. G.f.: -x*(x+1) * (x^2+1)^2 / (x^3+x-1). - Colin Barker, Jul 03 2013

A232723 Sequence (or tree) generated by these rules: 0 is in S, and if x is in S, then 2*x and 1 - x are in S, and duplicates are deleted as they occur.

Original entry on oeis.org

0, 1, 2, 4, -1, 8, -3, -2, 16, -7, -6, -4, 3, 32, -15, -14, -12, 7, -8, 5, 6, 64, -31, -30, -28, 15, -24, 13, 14, -16, 9, 10, 12, -5, 128, -63, -62, -60, 31, -56, 29, 30, -48, 25, 26, 28, -13, -32, 17, 18, 20, -9, 24, -11, -10, 256, -127, -126, -124, 63
Offset: 1

Views

Author

Clark Kimberling, Nov 28 2013

Keywords

Comments

Let S be the set of numbers defined by these rules: 0 is in S, and if x is in S, then 2*x and 1 - x are in S. Then S is the set of integers, which arise in generations. Deleting duplicates as they occur, the generations are given by g(1) = (0), g(2) = (1), g(3) = (2), g(4) = (4,-1), g(5) = (8,-3,-2), etc. Concatenating these gives A232723. Every integer occurs exactly once in S. The even integers occupy the positions given by the lower Wythoff sequence, A000201; the odds, by the upper Wythoff sequence, A001950. The positive integers occupy the positions given by A189035, and the positions of the nonpositives, by A189034.
Inverse beginning with 0: 1, 2, 3, 13, 4, 20, 21, 18, 6, 31, 32, 89, 33, 28, 29, 26, 9, 49, 50, 136, 51, 143, 144, 141, 53, 44, ..., . - Robert G. Wilson v, Jun 17 2014

Examples

			Each x begets 2*x and 1 - x, and if either has already occurred it is deleted. Thus, 0 begets 1, which begets 2, which begets (4,-1), etc.
		

Crossrefs

Programs

  • Mathematica
    x = {0}; Do[x = DeleteDuplicates[Flatten[Transpose[{x, 2*x, 1 - x}]]], {10}]; x  (* Peter J. C. Moses, Nov 28 2013 *)
    Nest[ DeleteDuplicates[ Flatten[ # /. a_Integer -> {2a, 1-a}]]&, {0}, 9] (* Robert G. Wilson v, Jun 17 2014 *)

A233694 Position of n in the sequence (or tree) S generated in order by these rules: 0 is in S; if x is in S then x + 1 is in S; if nonzero x is in S then 1/x is in S; if x is in S, then i*x is in S; where duplicates are deleted as they occur.

Original entry on oeis.org

1, 2, 3, 5, 11, 23, 49, 102, 212, 443, 926, 1939, 4064, 8509, 17816, 37303, 78105, 163544, 342454, 717076, 1501502, 3144024, 6583334, 13784969
Offset: 0

Views

Author

Clark Kimberling, Dec 19 2013

Keywords

Comments

It can be proved using the division algorithm for Gaussian integers that S is the set of Gaussian rational numbers: (b + c*i)/d, where b,c,d are integers and d is not 0.
The differences of this sequence give the number of elements in each level of the tree. This means that d(n) = a(n) - a(n-1) is at least 1, and is bounded by 3*d(n-1), since there are three times as many elements in each level, before we exclude repetitions. - Jack W Grahl, Aug 10 2018

Examples

			The first 16 numbers generated are as follows: 0, 1, 2, i, 3, 1/2, 2 i, 1 + i, -i, -1, 4, 1/3, 3 i, 3/2, i/2, 1 + 2 i. The positions of the nonnegative integers are 1, 2, 3, 5, 11.
		

Crossrefs

Programs

  • Mathematica
    Off[Power::infy]; x = {0}; Do[x = DeleteDuplicates[Flatten[Transpose[{x, x + 1, 1/x, I*x} /. ComplexInfinity -> 0]]], {18}]; On[Power::infy]; t1 = Flatten[Position[x, _?(IntegerQ[#] && NonNegative[#] &)]]    (* A233694 *)
    t2 = Flatten[Position[x, _?(IntegerQ[#] && Negative[#] &)]]  (* A233695 *)
    t = Union[t1, t2]  (* A233696 *)
    (* Peter J. C. Moses, Dec 21 2013 *)

Extensions

More terms from Jack W Grahl, Aug 10 2018

A233696 Positions of integers in the sequence (or tree) S generated in order by these rules: 0 is in S; if x is in S then x + 1 is in S; if nonzero x is in S then 1/x is in S; if x is in S, then i*x is in S; where duplicates are deleted as they occur.

Original entry on oeis.org

1, 2, 3, 5, 10, 11, 18, 23, 30, 49, 56, 102, 109, 212, 219, 443, 450, 926, 933, 1939, 1946, 4064, 4071, 8509, 8516, 17816, 17823, 37303, 37310, 78105, 78112, 163544, 163551
Offset: 1

Views

Author

Clark Kimberling, Dec 19 2013

Keywords

Comments

It can be proved using the division algorithm for Gaussian integers that S is the set of Gaussian rational numbers: (b + c*i)/d, where b,c,d are integers and d is not 0.

Examples

			The first 16 numbers generated are as follows:  0, 1, 2, i, 3, 1/2, 2 i, 1 + i, -i, -1, 4, 1/3, 3 i, 3/2, i/2, 1 + 2 i.  Positions of integers 0, 1, 2, 3, -1, 4,... are 1,2,3,5,10,11,....
		

Crossrefs

Programs

  • Mathematica
    Off[Power::infy]; x = {0}; Do[x = DeleteDuplicates[Flatten[Transpose[{x, x + 1, 1/x, I*x} /. ComplexInfinity -> 0]]], {18}]; On[Power::infy]; t1 = Flatten[Position[x, _?(IntegerQ[#] && NonNegative[#] &)]]    (*A233694*)
    t2 = Flatten[Position[x, _?(IntegerQ[#] && Negative[#] &)]]  (*A233695*)
    t = Union[t1, t2]  (*A233696*)
    (* Peter J. C. Moses, Dec 21 2013 *)

Extensions

Definition and example corrected. - R. J. Mathar, May 06 2017
Showing 1-10 of 15 results. Next