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.

A367795 Triangle read by rows, where row n = L(n) is defined by L(1) = [1,0] and L(n+1) is obtained from L(n) by inserting their binary concatenation between elements x,y.

Original entry on oeis.org

1, 0, 1, 2, 0, 1, 6, 2, 4, 0, 1, 14, 6, 26, 2, 20, 4, 8, 0, 1, 30, 14, 118, 6, 218, 26, 106, 2, 84, 20, 164, 4, 72, 8, 16, 0, 1, 62, 30, 494, 14, 1910, 118, 950, 6, 1754, 218, 7002, 26, 3434, 106, 426, 2, 340, 84, 2708, 20, 5284, 164, 1316, 4, 584, 72, 1160, 8, 272, 16, 32, 0
Offset: 1

Views

Author

Luc Rousseau, Nov 30 2023

Keywords

Comments

0 is considered to be a 1-bit-long number and has 0 for binary expansion.
The numbers of bits of the numbers in this triangle are provided by the A049456 triangle.
The sorted set of the numbers that occur in some row of this triangle is provided by A367745.

Examples

			Triangle begins:
  1 0
  1 2 0
  1 6 2 4 0
  1 14 6 26 2 20 4 8 0
  1 30 14 118 6 218 26 106 2 84 20 164 ...
Or the same in binary:
  1 0
  1 10 0
  1 110 10 100 0
  1 1110 110 11010 10 10100 100 1000 0
  1 11110 1110 1110110 110 11011010 11010 1101010 10 1010100 10100 10100100 ...
		

Crossrefs

Programs

  • PARI
    sz(n)=if(n==0, 1, logint(n, 2)+1)
    L(n)=if(n==1, List([1, 0]), my(LL=L(n-1), k=#LL); while(k>1, listinsert(LL, (LL[k-1] << sz(LL[k])) + LL[k], k); k--); LL)
    for(k=1,8,my(l=L(k));for(i=1,#l,print1(l[i],", ")))
    
  • Python
    from itertools import chain, count, islice, zip_longest
    def agen(): # generator of terms
        L = ["1", "0"]
        for k in count(1):
            yield from (int(t, 2) for t in L)
            Lnew = [s+t for s, t in zip(L[:-1], L[1:])]
            L = [t for t in chain(*zip_longest(L, Lnew)) if t is not None]
    print(list(islice(agen(), 69))) # Michael S. Branicky, Nov 30 2023

Formula

Length of row n = #L(n) = 2^(n-1) + 1 = A000051(n-1).