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 42 results. Next

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

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

A245219 Continued fraction expansion of the constant c in A245218; c = sup{f(n,1)}, where f(1,x) = x + 1 and thereafter f(n,x) = x + 1 if n is in A001951, else f(n,x) = 1/x.

Original entry on oeis.org

3, 2, 3, 2, 3, 2, 2, 3, 2, 3, 2, 2, 3, 2, 3, 2, 3, 2, 2, 3, 2, 3, 2, 2, 3, 2, 3, 2, 3, 2, 2, 3, 2, 3, 2, 2, 3, 2, 3, 2, 2, 3, 2, 3, 2, 3, 2, 2, 3, 2, 3, 2, 2, 3, 2, 3, 2, 3, 2, 2, 3, 2, 3, 2, 2, 3, 2, 3, 2, 2, 3, 2, 3, 2, 3, 2, 2, 3, 2, 3, 2, 2, 3, 2, 3, 2
Offset: 0

Views

Author

Clark Kimberling, Jul 13 2014

Keywords

Comments

See Comments at A245215.
Likely a duplicate of A097509. - R. J. Mathar, Jul 21 2014
Theorem: Referring to Problem B6 in the 81st William Lowell Putnam Mathematical Competition (see link), in the notation of the first solution, the sequence {c_i} equals A245219. This proves the conjecture in the previous comment. - Manjul Bhargava, Kiran Kedlaya, and Lenny Ng, Sep 09 2021.

Examples

			c = 3.43648484... ; the first 12 numbers f(n,1) comprise S(12) = {1, 2, 3, 1/3, 4/3, 7/3, 3/7, 10/7, 17/7, 24/7, 7/24, 31/24}; max(S(12)) = 24/7, with continued fraction [3,2,3].
		

Crossrefs

Cf. A226080 (infinite Fibonacci tree), A245217, A245218 (decimal expansion), A245222, A245225.
The following sequences are all essentially the same, in the sense that they are simple transformations of each other, with A003151 as the parent: A003151, A001951, A001952, A003152, A006337, A080763, A082844 (conjectured), A097509, A159684, A188037, A245219 (conjectured), A276862. - N. J. A. Sloane, Mar 09 2021

Programs

  • Mathematica
    tmpRec = $RecursionLimit; $RecursionLimit = Infinity; u[x_] := u[x] = x + 1; d[x_] := d[x] = 1/x; r = Sqrt[2]; w = Table[Floor[k*r], {k, 2000}]; s[1] = 1; s[n_] := s[n] = If[MemberQ[w, n - 1], u[s[n - 1]], d[s[n - 1]]]; max = Max[N[Table[s[n], {n, 1, 3000}], 200]] (* A245217 *)
    ContinuedFraction[max, 120] (* A245219 *)

Extensions

Offset changed by Andrew Howroyd, Jul 07 2024

A226207 Table by antidiagonals: D(m,n) = Zeckendorf distance between m and n.

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, 3, 2, 1, 0, 1, 2, 3, 4, 2, 1, 3, 3, 1, 2, 4, 4, 3, 3, 3, 0, 3, 3, 3, 4, 4, 3, 2, 1, 2, 2, 1, 2, 3, 4, 4, 3, 2, 4, 4, 0, 4, 4, 2, 3, 4, 4, 3, 2, 4, 1, 4, 4, 1, 4, 2, 3, 4, 5, 3, 4, 4, 1, 3, 0, 3
Offset: 1

Views

Author

Clark Kimberling, May 31 2013

Keywords

Comments

The Zeckendorf distance between positive integers m and n is defined as follows. Suppose that n = F(i1) + F(i2) + ... F(ij) is the Zeckendorf representation of n, where 1 is represented as F(1), not F(2). Let d(n) = F(i1 - 1) + F(i2 - 1) + ... + F(ij - 1); i.e., the indexes for n are downshifted to form d(n). Starting with any n, the number of arrows in the graph n -> d(n) -> d(d(n)) -> ... -> 1 is the "generation number" of n; write the k-th node as s(k,n). If m and n are positive integers, let K(m) and K(n) be the numbers for which s(K(m),m) = s(K(n),n). This first common ancestor, or root, of m and n is denoted r(m,n). The distance between m and n is D(m,n) = K(m) + K(n).
It is helpful to regard m and n as nodes in a "Zeckendorf tree" rooted a 1 with edges given by successive upshifting of indexes of Zeckendorf representations; then D(m,n) is the number of edges from m to n. Equivalently, one can start with the Fibonacci (or rabbit) tree of the positive rational numbers (A226080). Replacing each fraction in the tree by its position when the elements are arranged in the order in which generated gives the Zeckendorf array. Thus, D is not only the Zeckendorf graph metric for positive integers, but is also, isomorphically speaking, a graph metric for the positive rational numbers.
Suppose that b(n) and c(n) are sequences of positive integers. Sequences D(b(n),c(n)), with exceptions for first terms in some cases, are indicated here:
....
D(b(n),c(n)) ... b(n) ........ c(n)
A000012 ........ F(n) ........ F(n+1), consecutive Fibonacci numbers
A005408 ........ F(n) ........ L(n), Fibonacci(n) and Lucas(n)
A095791 ........ 1 ........... n
A000012 ........ A000201(n) .. A001950(n), the Wythoff sequences
A226208 ........ n ........... n+1
A226209 ........ n ........... n+2
A226210 ........ n............ F(n)
A226211 ........ n............ 2n
A226212 ........ n............ floor(n/2)
A226213 ........ n............ 2^n
A226214 ........ n............ n^2
A226215 ........ n! .......... (n+1)!

Examples

			Northwest corner of the distance table, D(m,n), m>=1, n>=1:
0 1 2 2 3 3 3 4 4 4 4 4 4
1 0 1 1 2 2 2 3 3 3 3 3 4
2 1 0 2 1 1 3 2 2 2 4 4 3
2 1 2 0 3 3 1 4 4 4 2 2 5
3 2 1 3 0 2 4 1 1 3 5 5 2
3 2 3 1 4 4 0 5 5 5 1 1 6
4 3 2 4 1 3 5 0 2 4 6 6 1
4 3 2 4 1 3 5 2 0 4 6 6 3
4 3 2 4 3 1 5 4 4 0 6 6 5
4 3 4 2 5 5 1 6 6 6 0 2 7
4 3 4 2 5 5 1 6 6 6 2 0 7
5 4 3 5 2 4 6 1 3 5 7 7 0
The distance from 36 to 26 is found here, showing successive downsteps:
36 = 34 + 8 + 3 + 1 -> 21 + 5 + 2 -> 13 + 3 + 1 -> 8 + 2
26 = 21 + 5 -> 13 + 3 -> 8 + 2
Thus, D(36,26) = 3 + 2 = 5; i.e. the root of 36 and 26, is 10; it takes 3 downshifts to get from 36 to 10 and 2 downshifts from 26 to 10, hence 5 edges in the Zeckendorf graph metric to get from 36 to 26.
		

Crossrefs

Programs

  • Mathematica
    zeck[n_Integer] := Block[{k = Ceiling[Log[GoldenRatio, n*Sqrt[5]]], t = n, z = {}}, While[k > 1, If[t >= Fibonacci[k], AppendTo[z, 1]; t = t - Fibonacci[k],  AppendTo[z, 0]]; k--]; If[n > 0 && z[[1]] == 0, Rest[z], z]]; d[n1_, n2_] := Module[{z1 = zeck[n1], z2 = zeck[n2]}, Length[z1] + Length[z2] - 2 (NestWhile[# + 1 &, 1, z1[[#]] == z2[[#]] &, 1,         Min[{Length[z1], Length[z2]}]] - 1)]; Table[d[m, n], {m, 1, 20}, {n, 1, 20}] // TableForm (* A226207 array *)
    Flatten[Table[d[k, n + 1 - k], {n, 1, 12}, {k, 1, n}]]  (* A226207 sequence *) (* Peter J. C. Moses, May 30 2013 *)

A245215 Decimal expansion of inf{f(n,1)}, where f(1,x) = x + 1 and thereafter f(n,x) = f(n-1,x) + 1 if n is in A000201, else f(n,x) = 1/f(n-1,x).

Original entry on oeis.org

3, 6, 6, 3, 0, 4, 6, 9, 4, 6, 5, 3, 2, 7, 2, 6, 5, 6, 6, 8, 2, 4, 9, 4, 1, 3, 1, 4, 2, 9, 0, 9, 6, 6, 9, 2, 9, 9, 8, 4, 2, 7, 8, 8, 9, 3, 9, 2, 5, 4, 3, 1, 6, 0, 4, 1, 0, 3, 1, 0, 3, 8, 0, 6, 3, 6, 0, 0, 5, 6, 4, 5, 2, 9, 0, 6, 1, 5, 4, 6, 1, 6, 9, 4, 9, 5
Offset: 1

Views

Author

Clark Kimberling, Jul 13 2014

Keywords

Comments

Equivalently, f(n,x) = 1/(f(n-1,x) if n is in A001950 (upper Wythoff sequence, given by w(n) = floor[tau*n], where tau = (1 + sqrt(5))/2, the golden ratio) and f(n,x) = f(n-1) + 1 otherwise. Let c = inf{f(n,1)}. The continued fraction of c is [0,2,1,2,1,2,2,1,2,2,1,2, ...], and the continued fraction of sup{f(n,x)}, alias -2 + 1/c, appears to be identical to the Hofstadter eta-sequence at A006340: (2, 1, 2, 1, 2, 2, 1, 2, 2, 1, 2,...). Other limiting constants are similarly obtained using other pairs of Beatty sequences:
...
Beatty sequence .... inf{f(n,1)} ... sup{f(n,1)}
A000201 (tau) ...... A245215 ....... A245216
A001951 (sqrt(2)) .. A245217 ....... A245218; cont. fr. A245219
A022838 (sqrt(3)) .. A245220 ....... A245221; cont. fr. A245222
A054385 (e/(e-1)) .. A245223 ....... A245224; cont. fr. A245225

Examples

			c = 0.366304694653272656682494131429096692998...  The first 12 numbers f(n,1) comprise S(12) = {1, 2, 1/2, 3/2, 5/2, 2/5, 7/5, 5/7, 12/7, 19/7, 7/19, 26/19}; min(S(12)) = 7/19 = 0.36842...
		

Crossrefs

Cf. A226080 (infinite Fibonacci tree), A006340, A245216, A245217, A245220, A245223, A246129.

Programs

  • Mathematica
    tmpRec = $RecursionLimit; $RecursionLimit = Infinity; u[x_] := u[x] = x + 1; d[x_] := d[x] = 1/x; r = GoldenRatio; w = Table[Floor[k*r], {k, 2000}]; s[1] = 1; s[n_] := s[n] = If[MemberQ[w, n - 1], u[s[n - 1]], d[s[n - 1]]]; $RecursionLimit = tmpRec;
    m = Min[N[Table[s[n], {n, 1, 4000}], 300]]
    t = RealDigits[m]  (* A245215 *)
    (* Peter J. C. Moses, Jul 04 2014 *)

Formula

a(n)*(2 + sup{f(n,1)}) = 1.
Equals 1/A245216 = A246129 - 2. - Hugo Pfoertner, Nov 10 2024

A245217 Decimal expansion of inf{f(n,1)}, where f(1,x) = x + 1 and thereafter f(n,x) = x + 1 if n is in A001951, else f(n,x) = 1/x.

Original entry on oeis.org

2, 9, 0, 9, 9, 5, 0, 2, 7, 0, 8, 6, 5, 9, 0, 6, 3, 0, 7, 4, 0, 5, 1, 1, 6, 6, 8, 1, 8, 3, 7, 7, 7, 6, 5, 1, 3, 8, 5, 4, 3, 2, 0, 1, 6, 1, 0, 9, 6, 3, 8, 8, 9, 9, 6, 6, 2, 3, 6, 0, 5, 9, 9, 9, 3, 0, 5, 6, 4, 4, 0, 8, 2, 9, 8, 2, 1, 1, 8, 9, 6, 3, 0, 3, 3, 1
Offset: 1

Views

Author

Clark Kimberling, Jul 13 2014

Keywords

Comments

See Comments at A245215.

Examples

			c = 0.29099502708659063074051166818377765138543201...  The first 12 numbers f(n,1) comprise S(12) = {1, 2, 3, 1/3, 4/3, 7/3, 3/7, 10/7, 17/7, 24/7, 7/24, 31/24}; min(S(12)) = 7/24 = 0.29166...
		

Crossrefs

Cf. A226080 (infinite Fibonacci tree), A245215, A245218, A245220, A245223.

Programs

  • Mathematica
    tmpRec = $RecursionLimit; $RecursionLimit = Infinity; u[x_] := u[x] = x + 1; d[x_] := d[x] = 1/x; r = Sqrt[2]; w = Table[Floor[k*r], {k, 2000}]; s[1] = 1; s[n_] := s[n] = If[MemberQ[w, n - 1], u[s[n - 1]], d[s[n - 1]]]; $RecursionLimit = tmpRec;
    m = Min[N[Table[s[n], {n, 1, 4000}], 300]]
    t = RealDigits[m]  (* A245217 *)
    (* Peter J. C. Moses, Jul 04 2014 *)

Formula

a(n)*sup{f(n,1)} = 1.

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

A245222 Continued fraction expansion of the constant c in A245221; c = sup{f(n,1)}, where f(1,x) = x + 1 and thereafter f(n,x) = x + 1 if n is in A022838, else f(n,x) = 1/x.

Original entry on oeis.org

2, 1, 2, 1, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1
Offset: 0

Views

Author

Clark Kimberling, Jul 14 2014

Keywords

Comments

See Comments at A245215.
Appears to be the same as the sequence 1 + [x == 0 (mod sqrt(3))], as x runs over the elements of N U N*sqrt(3) in increasing order, where N = {0, 1, 2, 3, ...} and [...] is the Iverson bracket. - M. F. Hasler, Feb 06 2025

Examples

			c = 2.7207664507294752975469517348171513242... ; the first 12 numbers f(n,1) comprise S(12) = {1, 2, 1/2, 3/2, 2/3, 5/3, 8/3, 3/8, 11/8, 8/11, 19/11, 11/19}; max(S(12)) = 8/3, with continued fraction [2,1,2].
From _M. F. Hasler_, Feb 06 2025: (Start)
Illustration of the "multiple of sqrt(3)" comment:
  n:  0   1   2    3   4    5    6   7   8    9   10  11  12   13  14  15
  x:  0   1  1.73  2   3   3.46  4   5  5.20  6  6.93  7   8  8.66  9  10
  m:  1   0   1    0   0    1    0   0   1    0   1    0   0   1    0   0
Here, x lists the elements of N U N*sqrt(3), and m = 1 if x == 0 (mod sqrt(3)), i.e., x is an integer multiple of sqrt(3). The sequence a(n) is m + 1. (End)
		

Crossrefs

Cf. A226080 (infinite Fibonacci tree), A245217, A245219, A245220, A245221 (decimal expansion).
Cf. A144612 (Sturmian word of slope (3-sqrt(3))/2; same as 2-a(n)).
Cf. A006337 (Hofstadter's eta sequence: an analog with sqrt(2)).

Programs

  • Mathematica
    tmpRec = $RecursionLimit; $RecursionLimit = Infinity; u[x_] := u[x] = x + 1; d[x_] := d[x] = 1/x; r = Sqrt[3]; w = Table[Floor[k*r], {k, 2000}]; s[1] = 1; s[n_] := s[n] = If[MemberQ[w, n - 1], u[s[n - 1]], d[s[n - 1]]]; max = Max[N[Table[s[n], {n, 1, 3000}], 200]] (* A245221 *)
    ContinuedFraction[max, 120] (* A245222 *)
  • PARI
    /* illustration of the comment related to sqrt(3)*/
    [1+(abs(x-x\/s*s)<1e-9) | x<-Set(concat(Col([1.,s=sqrt(3)]~*[0..99])))[1..99] ] \\ M. F. Hasler, Feb 06 2025

Formula

a(n) = 2 - A144612(n) for all n > 0. - M. F. Hasler, Feb 06 2025

Extensions

Offset changed by Andrew Howroyd, Aug 08 2024

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 *)
Showing 1-10 of 42 results. Next