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

A368432 Inverse permutation to A368431.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 9, 10, 8, 11, 12, 13, 14, 15, 20, 21, 18, 22, 16, 17, 19, 23, 24, 25, 26, 27, 28, 29, 30, 31, 43, 44, 40, 45, 37, 38, 41, 46, 33, 34, 32, 35, 36, 39, 42, 47, 49, 50, 48, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 90, 91, 86, 92
Offset: 0

Views

Author

Rémy Sigrist, Dec 24 2023

Keywords

Examples

			A368431(42) = 46, so a(46) = 42.
		

Crossrefs

Cf. A368431.

Programs

  • PARI
    See Links section.
    
  • Python
    from itertools import islice
    from functools import reduce
    def uniq(r): return reduce(lambda u, e: u if e in u else u+[e], r, [])
    def A368431gen():  # generator of A368431
        R, aset = [["0", "1"]], set()
        while R:
            r = R.pop(0)
            for b in r:
                d = int(b, 2)
                if d not in aset: yield d; aset.add(d)
            if len(r) > 1: R.append(uniq([r[k]+"0" for k in range(1, len(r))]))
            R.append(uniq([r[0]+"0", r[0]+"1"] + [r[k]+"1" for k in range(1, len(r))]))
    def agen(): # generator of terms
        adict, n = dict(), 0
        for i, k in enumerate(A368431gen()):
            if k not in adict:
                adict[k] = i
            while n in adict: yield adict[n]; n += 1
    print(list(islice(agen(), 70))) # Michael S. Branicky, Dec 24 2023

A367562 Iterates of the Christmas tree pattern map (A367508), read by rows and converted to decimal.

Original entry on oeis.org

0, 1, 2, 0, 1, 3, 4, 5, 2, 6, 0, 1, 3, 7, 10, 8, 9, 11, 12, 4, 5, 13, 2, 6, 14, 0, 1, 3, 7, 15, 20, 21, 18, 22, 16, 17, 19, 23, 24, 25, 10, 26, 8, 9, 11, 27, 12, 28, 4, 5, 13, 29, 2, 6, 14, 30, 0, 1, 3, 7, 15, 31, 42, 40, 41, 43, 44, 36, 37, 45, 34, 38, 46, 32, 33, 35, 39, 47
Offset: 1

Views

Author

Paolo Xausa, Nov 23 2023

Keywords

Comments

See A367508 for the description of the Christmas tree patterns, references and links.

Examples

			The first 4 tree pattern orders are shown below (on the right their elements are converted to decimal: the present sequence is obtained by reading the right half of the diagram left to right, top to bottom).
The sequence of the terms in chains of length 1 (marked with asterisks) coincides with the positive terms of A014486.
.
Order 1:                        |
              0  1              |      0  1
                                |
Order 2:                        |
               10               |        2*
           00  01  11           |     0  1  3
                                |
Order 3:                        |
            100  101            |      4  5
            010  110            |      2  6
       000  001  011  111       |   0  1  3  7
                                |
Order 4:                        |
              1010              |       10*
        1000  1001  1011        |     8  9 11
              1100              |       12*
        0100  0101  1101        |     4  5 13
        0010  0110  1110        |     2  6 14
  0000  0001  0011  0111  1111  |  0  1  3  7 15
.
		

Crossrefs

Programs

  • Mathematica
    With[{imax=6},Map[FromDigits[#,2]&,NestList[Map[Delete[{If[Length[#]>1,Map[#<>"0"&,Rest[#]],Nothing],Join[{#[[1]]<>"0"},Map[#<>"1"&,#]]},0]&],{{"0","1"}},imax-1],{3}]] (* Generates terms up to order 6 *)
  • Python
    from itertools import islice
    from functools import reduce
    def uniq(r): return reduce(lambda u, e: u if e in u else u+[e], r, [])
    def agen():  # generator of terms
        R = [["0", "1"]]
        while R:
            r = R.pop(0)
            yield from map(lambda b: int(b, 2), r)
            if len(r) > 1: R.append(uniq([r[k]+"0" for k in range(1, len(r))]))
            R.append(uniq([r[0]+"0", r[0]+"1"] + [r[k]+"1" for k in range(1, len(r))]))
    print(list(islice(agen(), 77))) # Michael S. Branicky, Nov 23 2023
Showing 1-2 of 2 results.