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-4 of 4 results.

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

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

Original entry on oeis.org

1, 2, 3, 6, 4, 9, 7, 18, 5, 12, 10, 27, 8, 21, 19, 54, 15, 13, 36, 11, 30, 28, 81, 24, 22, 63, 20, 57, 55, 162, 16, 45, 14, 39, 37, 108, 33, 31, 90, 29, 84, 82, 243, 25, 72, 23, 66, 64, 189, 60, 58, 171, 56, 165, 163, 486, 17, 48, 46, 135, 42, 40, 117, 38
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 3*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,3), g(3) = (6,4,9), g(4) = (7,18,5,8,10,27), etc. Concatenating these gives A232561, a permutation of the positive integers. The number of numbers in g(n) is A001590(n), the n-th tribonacci 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 3*x if 3*x has not already occurred.

Examples

			Each x begets x + 1 and 3*x, but if either has already occurred it is deleted.  Thus, 1 begets 2 and 3; in the next generation, 2 begets only 6, and 3 begets 4 and 9.
		

Crossrefs

Programs

  • Mathematica
    z = 8; g[1] = {1}; g[2] = {2, 3};
    g[n_] := Riffle[g[n - 1] + 1, 3 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}]]  (* A232561 *)
    Table[Length[g1[n]], {n, 1, z}]  (* A001590 *)
    t1 = Flatten[Table[Position[t, n], {n, 1, 200}]]  (* A232562 *)

A345253 Maximal Fibonacci tree: Arrangement of the positive integers as labels of a complete binary tree.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 8, 7, 9, 10, 13, 11, 14, 16, 21, 12, 15, 17, 22, 18, 23, 26, 34, 19, 24, 27, 35, 29, 37, 42, 55, 20, 25, 28, 36, 30, 38, 43, 56, 31, 39, 44, 57, 47, 60, 68, 89, 32, 40, 45, 58, 48, 61, 69, 90, 50, 63, 71, 92, 76, 97, 110, 144, 33, 41, 46, 59, 49
Offset: 1

Views

Author

J. Parker Shectman, Jun 12 2021

Keywords

Comments

Every positive integer occurs exactly once, so that, as a sequence, a(n) is a permutation of the positive integers.
Descending from the root node 1, generate tree by outer composition of L(n) = n + F(Finv(n)) and R(n) = n + F(Finv(n) + 1), respectively, according to left or right branching, where F(n) = A000045(n) are the Fibonacci numbers and Finv(n) = A130233(n) is the 'lower' Fibonacci inverse. This produces each number by maximal Fibonacci expansion (cf. example below of Method 2, entry A343152, and links).
(Level of tree): The number of terms in this expansion of n is the level of the tree on which n appears, A112310(n-1) + 1 = A200648(n+1). The number of terms in the expansion of a(n) is floor(log_2(n)) + 1 = A113473(n) = A070939(n) = A029837(n+1).
"Maximal Fibonacci expansion" maximizes the sum of coefficients over all Fibonacci numbers (of positive index), allowing both F(1) = 1 and F(2) = 1. Thus, it is just an expansion and not a representation (like "greedy" and "lazy"), as it "breaks the rule" by using two bits that correspond to elements of equal value, rather than using distinct basis elements (link). This reveals connections to the cf. sequences: Binary strings that emerge in lexicographic order from "maximal Fibonacci gaps" (example), binary trees of the positive integers, and I-D arrays "harvested" from the trees. To define the expansion uniquely, always include F(1), so that the expansion of positive integer n equals F(1) for n = 1 and F(1) prepended to the lazy Fibonacci representation of n-1 for n > 1. Hence, a(1) = 1, and for n > 1, a(n) = A095903(n-1) + 1. The "redundant" expansion arranges the positive integers in the single binary tree {T(n,k)}, rather than the two trees at A255773 and A255774 that result from representation (see link).
(Left-to-right order in tree): Each F(t)-sized block (F(t+1), ..., F(t+2) - 1) of successive positive integers ("Fibonacci cohort" t) appears in right-to-left order in the tree as reordered in A343152, where elements of each cohort appear consecutively (see link).
Descending from the root node 1, generate tree by the inner composition of A026351 and A026352, that is, one plus the sequences of lower and upper Wythoff numbers, A000201 and A001950, respectively, according to left or right branching (see example below of Method 1 and links).
Generate tree from (one plus) the number of (initial) zeros on the positive integers for the outer composition of sequences, A060143 and A060144, respectively, according to left or right branching descending from the identity (c.f example below of Method 3 and links).
The lower Wythoff numbers, A000201, appear exclusively in the 1st, 3rd, 5th, ... right clades of the tree, while the upper Wythoff numbers A001950, appear exclusively in the 2nd, 4th, 6th, ... right clades of the tree. Here, the k-th right clade comprises the nodes at positions 2^(k+1) and 2^k + 1, together with all descendants of the latter (link).
(Duality with tree A232560, and related arrays): Consider the labeled binary trees a(n) = A232560(A059893(n)) and A232560(n) = a(A059893(n)). Labels along maximal straight paths that always branch left in a(n) give rows of array A345252, while labels along maximal straight paths that always branch left in A232560 give rows of array A083047.
Sorting the labels from each successive right clade of the binary tree a(n) gives the successive columns of A083047, while sorting labels from each successive right clade of A232560 gives each successive column of A345252. This makes the trees a(n) and A232560 "blade-duals," blade being a contraction of branch-clade (see entry for A345254 and link). A200648(n)+1 gives the level of the tree on which elements of array first-columns A345252(n,1) and A083047(n,1) appear.
(Palindromes and coincidence of elements): Trees a(n) and A232560 coincide when the sequence of left and right branching is a palindrome: a(A329395(n)) = A232560(A329395(n)). As Kimberling notes (cf. A059893), this happens at fixed points of A059893(n) or, equivalently, at n for which A081242(n) is a palindrome.
The inverse permutation of a(n) as a sequence can be read from a "tetrangle" or "irregular triangle" tableau with F(t) (Fibonacci number) entries on each row t, for t = 1, 2, 3, ..., in which an entry on row t is 2*x the entry x immediately above it on row t-1, if such exists, or otherwise 2*x + 1 the entry x in the corresponding position on row t-2 (thus generating new rows as in A243571 but without sorting the numbers into increasing order, linked reference):
1,
2,
3, 4,
5, 6, 8,
7, 9, 10, 12, 16,
11, 13, 17, 14, 18, 20, 24, 32,
...
With the right-justified tableau substituted by a left-justified tableau, the same procedure yields the inverse permutation for the "minimal Fibonacci tree," A048680(A059893(n)), the "cohort-dual" tree of a(n), where "cohort" t is the F(t)-sized block of successive entries in the tableau (see entry for A345252, linked reference).
(Coincidence of elements): a(A020988(n)) = A048680(A059893(A020988(n))) = A099919(n) and a(A020989(n)) = A048680(A059893(A020989(n))) = A049651(n). Collectively, a(A061547(n)) = A048680(A059893(A061547(n))) = union(A049651(n), A099919(n)).
With two types of duality, the tree forms a quartet of binary-tree arrangements of the positive integers, together with its blade dual A232560, its cohort dual A048680(A059893), and blade dual A048680 of the latter.
Order in the tree is "memory-less": Let a(n) and a(m) label nodes at positions n and m, respectively. Let d1 and d2 be two descending paths, i.e., sequences branching left or right from a starting node. (Nodal positions for the left and right children of the node at position p are given by 2*p and 2*p + 1, resp., and d1 and d2 are compositions of these.) Then a(d1(n)) < a(d2(n)) if and only if a(d1(m)) < a(d2(m)) (linked reference).

Examples

			As a complete binary tree:
                    1
           /                 \
          2                   3
      /       \          /        \
     4         5        6          8
    / \       / \      / \        / \
   7    9    10   13   11   14   16   21
  / \  / \  /  \ /  \ /  \ /  \ /  \ /  \
  ...
By maximal Fibonacci expansion:
                                        F(1)
                      /                                       \
                F(1) + F(2)                               F(1) + F(3)
           /                    \                    /                  \
  F(1) + F(2) + F(3)   F(1) + F(2) + F(4)   F(1) + F(3) + F(4)   F(1) + F(3) + F(5)
  ...
"Fibonacci gaps," or differences between successive indices in maximal Fibonacci expansion above, are A007931(n-1) for n > 1 (see link):
                   *
          /                  \
         1                    2
     /       \           /        \
    11        12        21        22
   /  \      /  \      /  \      /  \
  111  112  121  122  211  212  221  222
  / \  / \  / \  / \  / \  / \  / \  / \
  ...
In examples of the three methods below:
Branch left-right-right down the tree to arrive at nodal position n = 2*(2*(2*1) + 1) + 1 = 11;
Branch right-left-left down the tree to arrive at nodal position n = 2*(2*(2*1 + 1)) = 12.
Tree by inner composition of (one plus) the lower and upper Wythoff sequences, A000201 and A001950 (Method 1):
a(11) = A000201(A001950(A001950(1) + 1) + 1) + 1 = 13.
a(12) = A001950(A000201(A000201(1) + 1) + 1) + 1 = 11.
Tree by (outer) composition of branching functions L(n) = n + F(Finv(n)) and R(n) = n + F(Finv(n) + 1), where F(n) = A000045(n) and Finv(n) = A130233(n) (Method 2):
a(11) = R(R(L(1))) = 13.
a(12) = L(R(R(1))) = 11.
Tree by outer composition of A060143 and A060144 (Wythoff inverse sequences) (Method 3):
a(11) = 13, position of first nonzero in A060144(A060144(A060143(m))) = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, ..., for m = 1, 2, 3, ....
a(12) = 11, position of first nonzero in A060143(A060143(A060144(m))) = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, ..., for m = 1, 2, 3, ....
		

Crossrefs

Programs

  • Mathematica
    (* For binary tree implementations, see supporting file under LINKS *)
    a[n_] := (x = 0; y = 0; BDn = Reverse[IntegerDigits[n, 2]]; imax = Length[BDn] - 1; For[i = 0, i <= imax, i++, {x, y} = {y + 1, x + y}; If[BDn[[i + 1]] == 1, {x, y} = {y, x + y}]]; y);
    (* Adapted from PARI code of Kevin Ryde *)
  • PARI
    a(n) = my(x=0,y=0); for(i=0,logint(n,2), [x,y]=[y+1,x+y]; if(bittest(n,i), [x,y]=[y,x+y])); y; \\ Kevin Ryde, Jun 19 2021

Formula

a(1) = 1 and for n > 1, a(n) = A095903(n-1) + 1.
a(n) = A232560(A059893(n)).

A345252 2-1-Fibonacci cohort array, a rectangular array T(n,k) read by downward antidiagonals.

Original entry on oeis.org

1, 2, 3, 4, 6, 5, 7, 11, 10, 8, 12, 19, 18, 16, 9, 20, 32, 31, 29, 17, 13, 33, 53, 52, 50, 30, 26, 14, 54, 87, 86, 84, 51, 47, 27, 15, 88, 142, 141, 139, 85, 81, 48, 28, 21, 143, 231, 230, 228, 140, 136, 82, 49, 42, 22, 232, 375, 374, 372, 229, 225, 137, 83, 76
Offset: 1

Views

Author

J. Parker Shectman, Jun 12 2021

Keywords

Comments

As a sequence, {a(n)} permutes the positive integers. As an array, {T(n,k)} is an interspersion-dispersion or I-D array (refer to Kimberling, 1st linked reference).
The top row of {T(n,k)} is A000071 or one less than the Fibonacci numbers = 1, 2, 4, 7, 12, ....
The top row of {T(n,k)} alternates lower and upper Wythoff numbers, A000201 and A001950, respectively, while all subsequent rows consist entirely of lower Wythoff numbers or entirely of upper Wythoff numbers (cf. generating tree A345253).
The left column (k = 1) of {T(n,k)} is n + F(Finv(n) + 1), for rows indexed n = 0, 1, 2, ..., where F(n) = A000045(n) are the Fibonacci numbers and Finv(n) = A130233(n) is the 'lower' Fibonacci inverse.
For rows indexed n = 0, 1, 2, ..., and columns indexed k = 1, 2, 3, ..., T(n,k) is given by T(n,k) = L^(k - 1) R(n), the image of n under a composition of branching functions L(n) = n + F(Finv(n)) and R(n) = n + F(Finv(n) + 1) (cf. generating tree A345253).
Write the positive integers in natural order (A000027) as a right-justified "tetrangle" or "irregular triangle" tableau with F(t) (Fibonacci number) entries on each row t, for t = 1, 2, 3, .... Then, columns of the tableau equal rows of {T(n,k)} (2nd linked reference):
1,
2,
3, 4,
5, 6, 7,
8, 9, 10, 11, 12,
13, 14, 15, 16, 17, 18, 19, 20,
...
(Duality with array A194030): With the right-justified tableau substituted by a left-justified tableau, the above procedure yields the array A194030, making {T(n,k)} and A194030 "cohort-dual" arrays, where "cohort" t is the F(t)-sized block (F(t + 1), ..., F(t + 2) - 1) of successive positive integers on row t of both tableaux (2nd link under references, which calls A194030 the "1-2-Fibonacci cohort array", by analogy).
Analogous to A345254, its left-justified tableau of the positive integers in cohorts with lengths powers of two replaced by the above right-justified tableau with the Fibonacci numbers as lengths of the cohorts.
(Duality with array A083047): Consider the labeled binary trees A345253(n) = A232560(A059893(n)) and A232560(n) = A345253(A059893(n)). Rows of array {T(n,k)} are the labels along maximal straight paths that always branch left in A345253, while rows of array A083047 are the labels along maximal straight paths that always branch left in A232560.
Column k of {T(n,k)} comprises the (sorted) labels in the k-th right clade of binary tree A232560, while column k of A083047 comprises the (sorted) labels in the k-th right clades of binary tree A345253. This makes the arrays {T(n,k)} and A083047 "blade-duals", blade being a contraction of branch-clade (cf. A345253 and 2nd linked reference).
(Mirror duality): A "mirror dual" I-D array or "inverse I-D array" (see Kimberling in 1st linked reference) is obtained by mirroring the tree A345253 cited above, i.e., taking maximal straight paths that always branch right in A345253. With three types of duality then, {T(n,k)} forms an octet of I-D arrays together with its cohort dual A194030 and mirror duals of these two, its blade dual A083047 and cohort dual A035513 of the latter, and their respective mirror duals, A132817 and A191436.
(Para-sequences): Sequences of row and column indices (see Conway-Sloane correspondence under A019586, citing Kimberling). For rows indexed n = 0, 1, 2, ..., the row index n of positive integer T(n,k) follows a right-justified tableau with F(t) entries on each row t, for t = 1, 2, 3, ..., in which an entry on row t equals the entry immediately above it on row t-1, if such exists, or otherwise equals the minimum positive integer excluded from the tableau so far:
0,
0,
1, 0,
2, 1, 0,
3, 4, 2, 1, 0,
5, 6, 7, 3, 4, 2, 1, 0,
...
For columns indexed k = 1, 2, 3, ..., the column index k of positive integer T(n,k) follows a right-justified tableau with F(t) entries on each row t, for t = 1, 2, 3, ..., in which an entry x+1 on row t equals one plus the entry x immediately above it on row t-1, if such exists, or otherwise equals one:
1,
2,
1, 3,
1, 2, 4,
1, 1, 2, 3, 5,
1, 1, 1, 2, 2, 3, 4, 6,
...

Examples

			Northwest corner of {T(n,k)}:
       k=1 k=2 k=3 k=4 k=5  k=6 ...
  n=0:   1,  2,  4,  7, 12,  20, ...
  n=1:   3,  6, 11, 19, 32,  53, ...
  n=2:   5, 10, 18, 31, 52,  86, ...
  n=3:   8, 16, 29, 50, 84, 139, ...
  n=4:   9, 17, 30, 51, 85, 140, ...
  ...
Northwest corner of {T(n,k)} in maximal Fibonacci expansion (see link):
       k=1             k=2                  k=3                       ...
  n=0: F(1),           F(1)+F(2),           F(1)+F(2)+F(3),           ...
  n=1: F(1)+F(3),      F(1)+F(3)+F(4),      F(1)+F(3)+F(4)+F(5),      ...
  n=2: F(1)+F(2)+F(4), F(1)+F(2)+F(4)+F(5), F(1)+F(2)+F(4)+F(5)+F(6), ...
  ...
Northwest corner of {T(n,k)} as "Fibonacci gaps," or differences between successive indices in maximal Fibonacci expansion above, (see link):
       k=1   k=2    k=3     k=4      k=5       k=6  ...
  n=0:   *,    1,    11,    111,    1111,    11111, ...
  n=1:   2,   21,   211,   2111,   21111,   211111, ...
  n=2:  12,  121,  1211,  12111,  121111,  1211111, ...
  n=3:  22,  221,  2211,  22111,  221111,  2211111, ...
  n=4: 122, 1221, 12211, 122111, 1221111, 12211111, ...
  ...
		

Crossrefs

Programs

  • Mathematica
    (* Define A000045 *)
    F[n_] := Fibonacci[n]
    (* Defined A130233 *)
    Finv[n_] := Floor[Log[GoldenRatio, Sqrt[5]n + 1]]
    (* Simplified Formula *)
    MatrixForm[Table[n + F[Finv[n] + k + 2] - F[Finv[n] + 2], {n, 0, 4}, {k, 1, 6}]]
    (* Branching Formula *)
    MatrixForm[Table[NestList[Function[# + F[Finv[#]]], n + F[Finv[n] + 1], 5], {n, 0, 4}]]

Formula

T(n,k) = n + F(Finv(n) + k + 2) - F(Finv(n) + 2), for rows indexed n = 0, 1, 2, ... and columns indexed k = 1, 2, 3, ..., where F(n) = A000045(n) and Finv(n) = A130233.
T(n,k) = L^(k - 1) R(n), where L(n) = n + F(Finv(n)) and R(n) = n + F(Finv(n) + 1).
Showing 1-4 of 4 results.