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.

Previous Showing 11-15 of 15 results.

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

A329752 a(0) = 0, a(n) = a(floor(n/2)) + (n mod 2) * floor(log_2(2n))^2 for n > 0.

Original entry on oeis.org

0, 1, 1, 5, 1, 10, 5, 14, 1, 17, 10, 26, 5, 21, 14, 30, 1, 26, 17, 42, 10, 35, 26, 51, 5, 30, 21, 46, 14, 39, 30, 55, 1, 37, 26, 62, 17, 53, 42, 78, 10, 46, 35, 71, 26, 62, 51, 87, 5, 41, 30, 66, 21, 57, 46, 82, 14, 50, 39, 75, 30, 66, 55, 91, 1, 50, 37, 86
Offset: 0

Views

Author

Alois P. Heinz, Nov 20 2019

Keywords

Examples

			For n = 11 = 1011_2 we have a(11) = 1^2 + 3^2 + 4^2 = 1 + 9 + 16 = 26.
		

Crossrefs

Programs

  • Maple
    a:= n-> (l-> add(l[-i]*i^2, i=1..nops(l)))(convert(n, base, 2)):
    seq(a(n), n=0..80);
    # second Maple program:
    a:= proc(n) option remember; `if`(n=0, 0,
          a(iquo(n, 2))+`if`(n::odd, ilog2(2*n)^2, 0))
        end:
    seq(a(n), n=0..80);

Formula

If n = Sum_{i=0..m} c(i)*2^i, c(i) = 0 or 1, then a(n) = Sum_{i=0..m} c(i)*(m+1-i)^2.
a(2^n-1) = n*(n+1)*(2*n+1)/6 = A000330(n).
a(2^n) = 1.
a(2^n+1) = n^2 + 1 = A002522(n).

A370819 Number of subsets of {1..n-1} whose cardinality is one less than the length of the binary expansion of n; a(0) = 0.

Original entry on oeis.org

0, 1, 1, 2, 3, 6, 10, 15, 35, 56, 84, 120, 165, 220, 286, 364, 1365, 1820, 2380, 3060, 3876, 4845, 5985, 7315, 8855, 10626, 12650, 14950, 17550, 20475, 23751, 27405, 169911, 201376, 237336, 278256, 324632, 376992, 435897, 501942, 575757, 658008, 749398, 850668
Offset: 0

Views

Author

Gus Wiseman, Mar 11 2024

Keywords

Examples

			The a(1) = 1 through a(7) = 15 subsets:
  {}  {1}  {1}  {1,2}  {1,2}  {1,2}  {1,2}
           {2}  {1,3}  {1,3}  {1,3}  {1,3}
                {2,3}  {1,4}  {1,4}  {1,4}
                       {2,3}  {1,5}  {1,5}
                       {2,4}  {2,3}  {1,6}
                       {3,4}  {2,4}  {2,3}
                              {2,5}  {2,4}
                              {3,4}  {2,5}
                              {3,5}  {2,6}
                              {4,5}  {3,4}
                                     {3,5}
                                     {3,6}
                                     {4,5}
                                     {4,6}
                                     {5,6}
		

Crossrefs

The version without subtracting one is A357812.
Dominates A370641, see also A370640.
A007318 counts subsets by cardinality.
A048793 lists binary indices, A000120 length, A272020 reverse, A029931 sum.
A058891 counts set-systems, A003465 covering, A323818 connected.
A070939 gives length of binary expansion.
A096111 gives product of binary indices.

Programs

  • Mathematica
    Table[If[n==0,0,Binomial[n-1,IntegerLength[n,2]-1]],{n,0,15}]

Formula

a(n) = binomial(n - 1, A029837(n+1) - 1) = binomial(n - 1, A113473(n) - 1) = binomial(n - 1, A070939(n) - 1) for n > 0.

A380757 Powers of primes that have a primitive root.

Original entry on oeis.org

1, 2, 3, 4, 5, 7, 9, 11, 13, 17, 19, 23, 25, 27, 29, 31, 37, 41, 43, 47, 49, 53, 59, 61, 67, 71, 73, 79, 81, 83, 89, 97, 101, 103, 107, 109, 113, 121, 125, 127, 131, 137, 139, 149, 151, 157, 163, 167, 169, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229
Offset: 1

Views

Author

Michael De Vlieger, Feb 01 2025

Keywords

Comments

Proper subset of A033948.
A046022 is a proper subset of this sequence.

Crossrefs

Programs

  • Mathematica
    With[{nn = 2^8},
      Complement[#, Array[2^# &, Floor@ Log2[#[[-1]]] + 2, 3]] &@
      Union[{1}, Prime@ Range@ PrimePi[#[[-1]] ], #] &@
      Select[Union@ Flatten@
        Table[a^2*b^3, {b, Surd[#, 3]}, {a, Sqrt[nn/b^3]}],
        PrimePowerQ] ]
  • Python
    from sympy import primepi, integer_nthroot
    def A380757(n):
        def bisection(f,kmin=0,kmax=1):
            while f(kmax) > kmax: kmax <<= 1
            kmin = kmax >> 1
            while kmax-kmin > 1:
                kmid = kmax+kmin>>1
                if f(kmid) <= kmid:
                    kmax = kmid
                else:
                    kmin = kmid
            return kmax
        def f(x): return n if x<6 else int(n+x-3-sum(primepi(integer_nthroot(x,k)[0])-1 for k in range(1,x.bit_length())))
        return bisection(f,n,n) # Chai Wah Wu, Feb 03 2025

Formula

Union of {1, 2, 4} and A061345.
This sequence is A000961 without A000079(k) for k > 2.
A033948 = union of {a(n)} and {2*a(n)} without 8 = union of {a(n)} and A278568, where {a(n)} represents this sequence.
Intersection of A000961 and A033948.
Define c(m) to be the number of terms that do not exceed m. Then for m >= 4, c(m) = 3 + (Sum_{k = 1..floor(log_2(m))} pi(floor(m^(1/k)))) - floor(log_2(m)) = 3 + A065515(m) - A113473(m).

A341270 a(n) = Sum_{k=1..n} a(n mod k) for n > 0; a(0) = 1.

Original entry on oeis.org

1, 1, 2, 3, 4, 6, 7, 10, 12, 15, 17, 25, 24, 32, 37, 45, 46, 63, 62, 82, 83, 97, 104, 141, 130, 158, 170, 201, 202, 255, 242, 302, 306, 350, 367, 448, 416, 503, 522, 610, 597, 716, 690, 825, 832, 921, 945, 1147, 1085, 1255, 1272, 1430, 1435, 1683, 1631, 1888
Offset: 0

Views

Author

Rok Cestnik, Feb 07 2021

Keywords

Examples

			a(1) = a(1 mod 1) = a(0) = 1.
a(2) = a(2 mod 1)+a(2 mod 2) = a(0)+a(0) = 2.
a(3) = a(3 mod 1)+a(3 mod 2)+a(3 mod 3) = a(0)+a(1)+a(0) = 3.
		

Crossrefs

For Sum_{k=1..n} n mod k see A004125.
For Sum_{k=1..n} a(k) see A000079.
For Max_{k=1..n} a(n mod k)+1 see A113473.

Programs

  • Maple
    a:= proc(n) option remember;
         `if`(n=0, 1, add(a(n mod k), k=1..n))
        end:
    seq(a(n), n=0..62);  # Alois P. Heinz, Feb 07 2021
  • Mathematica
    a[0] = 1; a[n_] := a[n] = Sum[a[Mod[n, k]], {k, 1, n}]; Array[a, 50, 0] (* Amiram Eldar, Feb 08 2021 *)
  • PARI
    a(n) = if (n==0, 1, sum(k=1, n, a(n % k))); \\ Michel Marcus, Feb 08 2021
  • Python
    a = [1]
    for n in range(1,1000):
        a.append(sum(a[n%k] for k in range(1,n+1)))
    
Previous Showing 11-15 of 15 results.