login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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). 10

%I #22 Jun 22 2022 07:34:45

%S 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,

%T 68,65,66,96,128,13,14,21,24,19,26,25,72,22,70,69,80,67,82,81,144,15,

%U 74,73,76,75,130,129,136,71,132,133,192,131,194,193,256,23

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

%C This is a permutation of the positive integers.

%C Apparently, a self-inverse permutation.

%C There are no fixed points.

%H Paul Tek, <a href="/A238757/b238757.txt">Table of n, a(n) for n = 1..10000</a>

%H Paul Tek, <a href="/A238757/a238757.txt">Perl program for this sequence</a>

%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>

%o (Perl) See Link section.

%o (Python)

%o from itertools import count, islice

%o def agen(): # generator of terms

%o aset, mink = set(), 1

%o for n in count(1):

%o an = mink

%o while an in aset or n&an: an += 1

%o aset.add(an); yield an

%o while mink in aset: mink += 1

%o print(list(islice(agen(), 64))) # _Michael S. Branicky_, Jun 22 2022

%Y Cf. A238758.

%K nonn

%O 1,1

%A _Paul Tek_, Mar 05 2014

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 23:26 EDT 2024. Contains 371917 sequences. (Running on oeis4.)