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.

A217589 Bit reversed 16-bit numbers.

This page as a plain text file.
%I A217589 #17 Nov 28 2024 11:45:05
%S A217589 0,32768,16384,49152,8192,40960,24576,57344,4096,36864,20480,53248,
%T A217589 12288,45056,28672,61440,2048,34816,18432,51200,10240,43008,26624,
%U A217589 59392,6144,38912,22528,55296,14336,47104,30720,63488,1024,33792,17408,50176,9216,41984
%N A217589 Bit reversed 16-bit numbers.
%C A217589 The 16-bit analog of the 8-bit version A160638, see there for further links and information.
%C A217589 An involutive (i.e., equal to its own inverse) permutation of the numbers 0,...,65535.
%H A217589 Vincenzo Librandi, <a href="/A217589/b217589.txt">Table of n, a(n) for n = 0..10000</a>
%F A217589 a(a(n))=n.
%F A217589 a(m)+a(n)=a(m+n) whenever n & m = 0, where "&" is binary bit-AND, i.e., whenever m and n have no (1-)bits in common.
%F A217589 a(n) is even for all n < 2^15 = a(1) and odd for all larger n.
%F A217589 a(n) = floor(A030101(n+65536)/2). - _Reinhard Zumkeller_, Jan 12 2013
%p A217589 a:= n-> Bits[Join](ListTools[Reverse](Bits[Split](n, bits=16))):
%p A217589 seq(a(n), n=0..37);  # _Alois P. Heinz_, Nov 28 2024
%t A217589 Table[FromDigits[Reverse[IntegerDigits[n, 2, 16]], 2], {n, 0, 50}] (* _T. D. Noe_, Oct 09 2012 *)
%t A217589 IntegerReverse[Range[0, 127], 2, 16] (* _Paolo Xausa_, Nov 28 2024 *)
%o A217589 (PARI) a(n)=sum(i=0,15,bittest(n,15-i)<<i)
%o A217589 (Haskell)
%o A217589 import Data.Bits (testBit, setBit)
%o A217589 import Data.Word (Word16)
%o A217589 a217589 :: Word16 -> Word16
%o A217589 a217589 n = rev 0 0 where
%o A217589    rev 16 y = y
%o A217589    rev i y = rev (i + 1) (if testBit n i then setBit y (15 - i) else y)
%o A217589 -- _Reinhard Zumkeller_, Jan 12 2013
%Y A217589 Cf. A160638.
%K A217589 nonn,base,fini
%O A217589 0,2
%A A217589 _M. F. Hasler_, Oct 07 2012