This site is supported by donations to The OEIS Foundation.



(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A057889 Bit-reverse of n, including as many leading as trailing zeros. 37


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

%T 22,27,28,23,30,31,32,33,34,49,36,41,50,57,40,37,42,53,52,45,58,61,48,

%U 35,38,51,44,43,54,59,56,39,46,55,60,47,62,63,64,65,66,97,68,81,98,113

%N Bit-reverse of n, including as many leading as trailing zeros.

%C In other words, keep the trailing zeros in the binary expansion of n fixed, but reverse all the digits up to that point. - _N. J. A. Sloane_, May 30 2016

%C A permutation of integers consisting only of fixed points and pairs. a(n)=n when n is a binary palindrome (including as many leading as trailing zeros), otherwise a(n)=A003010(n) (i.e. n has no axis of symmetry). A057890 gives the palindromes (fixed points, akin to A006995) while A057891 gives the "antidromes" (pairs).

%H N. J. A. Sloane, <a href="/A057889/b057889.txt">Table of n, a(n) for n = 0..16384</a>, May 30 2016 [First 8192 terms from _Ivan Neretin_, Jul 09 2015]

%F a(n) = A030101(A000265(n)) * A006519(n), with a(0)=0.

%e a(6)=6 because 0110 is a palindrome, but a(11)=13 because 1011 reverses into 1101.

%t Table[FromDigits[Reverse[IntegerDigits[n, 2]], 2]*2^IntegerExponent[n, 2], {n, 71}] (* _Ivan Neretin_, Jul 09 2015 *)

%o (Python)

%o def a(n):

%o x=bin(n)[2:]

%o y=x[::-1]

%o return int(str(int(y))+(len(x) - len(str(int(y))))*'0', 2)

%o print [a(n) for n in xrange(101)] # _Indranil Ghosh_, Jun 11 2017

%Y Cf. A030101, A000265, A006519, A006995, A057890, A057891.

%K easy,nonn,base,look

%O 0,3

%A _Marc LeBrun_, Sep 25 2000

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 April 19 20:04 EDT 2019. Contains 322291 sequences. (Running on oeis4.)