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.

Showing 1-2 of 2 results.

A217589 Bit reversed 16-bit numbers.

Original entry on oeis.org

0, 32768, 16384, 49152, 8192, 40960, 24576, 57344, 4096, 36864, 20480, 53248, 12288, 45056, 28672, 61440, 2048, 34816, 18432, 51200, 10240, 43008, 26624, 59392, 6144, 38912, 22528, 55296, 14336, 47104, 30720, 63488, 1024, 33792, 17408, 50176, 9216, 41984
Offset: 0

Views

Author

M. F. Hasler, Oct 07 2012

Keywords

Comments

The 16-bit analog of the 8-bit version A160638, see there for further links and information.
An involutive (i.e., equal to its own inverse) permutation of the numbers 0,...,65535.

Crossrefs

Cf. A160638.

Programs

  • Haskell
    import Data.Bits (testBit, setBit)
    import Data.Word (Word16)
    a217589 :: Word16 -> Word16
    a217589 n = rev 0 0 where
       rev 16 y = y
       rev i y = rev (i + 1) (if testBit n i then setBit y (15 - i) else y)
    -- Reinhard Zumkeller, Jan 12 2013
  • Maple
    a:= n-> Bits[Join](ListTools[Reverse](Bits[Split](n, bits=16))):
    seq(a(n), n=0..37);  # Alois P. Heinz, Nov 28 2024
  • Mathematica
    Table[FromDigits[Reverse[IntegerDigits[n, 2, 16]], 2], {n, 0, 50}] (* T. D. Noe, Oct 09 2012 *)
    IntegerReverse[Range[0, 127], 2, 16] (* Paolo Xausa, Nov 28 2024 *)
  • PARI
    a(n)=sum(i=0,15,bittest(n,15-i)<
    				

Formula

a(a(n))=n.
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.
a(n) is even for all n < 2^15 = a(1) and odd for all larger n.
a(n) = floor(A030101(n+65536)/2). - Reinhard Zumkeller, Jan 12 2013

A217557 The difference between the reversal of an 8-bit integer and the original integer.

Original entry on oeis.org

0, 127, 62, 189, 28, 155, 90, 217, 8, 135, 70, 197, 36, 163, 98, 225, -8, 119, 54, 181, 20, 147, 82, 209, 0, 127, 62, 189, 28, 155, 90, 217, -28, 99, 34, 161, 0, 127, 62, 189, -20, 107, 42, 169, 8, 135, 70, 197, -36, 91, 26, 153, -8, 119, 54, 181, -28, 99
Offset: 0

Views

Author

Jon Perry, Oct 06 2012

Keywords

Comments

The difference between the reversal of an 8-bit integer and the original integer.

Examples

			5 -> 00000101 -> 10100000 = 160 so a(5) = 155.
		

Crossrefs

Cf. A160638.

Programs

  • Mathematica
    Table[FromDigits[Reverse[PadLeft[IntegerDigits[n,2],8,0]],2]-n,{n,0,60}] (* Harvey P. Dale, Oct 12 2012 *)
  • PARI
    A217557(n)=sum(i=0,7,bittest(n,7-i)<M. F. Hasler, Oct 07 2012

Formula

a(n) = A160638(n) - n.
Showing 1-2 of 2 results.