login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A238758 Lexicographically earliest sequence of distinct positive integers such that a(n) AND n is a power of 2 for any n>0 (AND stands for the bitwise AND operator). 2

%I

%S 1,2,5,4,3,10,9,8,7,6,12,11,17,18,20,16,13,14,24,15,26,25,33,19,22,21,

%T 34,36,35,37,40,32,23,27,29,28,30,41,48,31,38,49,52,50,65,66,68,39,42,

%U 44,69,43,67,74,73,72,71,70,76,75,80,81

%N Lexicographically earliest sequence of distinct positive integers such that a(n) AND n is a power of 2 for any n>0 (AND stands for the bitwise AND operator).

%C This is a permutation of the positive integers.

%C Apparently, a self-inverse permutation.

%C The powers of 2 (A000079) are the fixed points.

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

%H Paul Tek, <a href="/A238758/a238758.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>

%t s = {}; Do[j=1; While[ MemberQ[s,j] || (b = BitAnd[j, n]) == 0 || BitAnd[b, b-1] > 0, j++]; AppendTo[s, j], {n, 62}]; s (* _Giovanni Resta_, Mar 05 2014 *)

%o (Perl) See Link section.

%Y Cf. A238757.

%K nonn

%O 1,2

%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 | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 26 20:36 EDT 2020. Contains 337374 sequences. (Running on oeis4.)