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.

A238757 Lexicographically earliest sequence of distinct positive integers such that for any n>0 we have (a(n) AND n) = 0 (where AND stands for the bitwise AND operator).

Original entry on oeis.org

2, 1, 4, 3, 8, 9, 16, 5, 6, 17, 20, 18, 32, 33, 48, 7, 10, 12, 36, 11, 34, 40, 64, 35, 38, 37, 68, 65, 66, 96, 128, 13, 14, 21, 24, 19, 26, 25, 72, 22, 70, 69, 80, 67, 82, 81, 144, 15, 74, 73, 76, 75, 130, 129, 136, 71, 132, 133, 192, 131, 194, 193, 256, 23
Offset: 1

Views

Author

Paul Tek, Mar 05 2014

Keywords

Comments

This is a permutation of the positive integers.
Apparently, a self-inverse permutation.
There are no fixed points.

Crossrefs

Cf. A238758.

Programs

  • Perl
    See Link section.
    
  • Python
    from itertools import count, islice
    def agen(): # generator of terms
        aset, mink = set(), 1
        for n in count(1):
            an = mink
            while an in aset or n&an: an += 1
            aset.add(an); yield an
            while mink in aset: mink += 1
    print(list(islice(agen(), 64))) # Michael S. Branicky, Jun 22 2022