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.

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