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-1 of 1 results.

A375183 In the binary expansion of n, complement bits at even positions and to the right of a 1 (the most significant bit corresponding to position 1).

Original entry on oeis.org

0, 1, 3, 2, 6, 7, 4, 5, 12, 13, 15, 14, 8, 9, 11, 10, 24, 25, 26, 27, 30, 31, 28, 29, 16, 17, 18, 19, 22, 23, 20, 21, 48, 49, 51, 50, 52, 53, 55, 54, 60, 61, 63, 62, 56, 57, 59, 58, 32, 33, 35, 34, 36, 37, 39, 38, 44, 45, 47, 46, 40, 41, 43, 42, 96, 97, 98, 99
Offset: 0

Views

Author

Rémy Sigrist, Aug 03 2024

Keywords

Comments

This sequence is a self-inverse permutation of the nonnegative integers.

Examples

			For n = 9: the binary expansion of 9 is "1001": the bit at position 2 (0) sits to the right of a 1 so we complement it, the bit at position 4 (1) sits to the right of a 0 so we keep it; the binary expansion of a(9) is "1101" and a(9) = 13.
		

Crossrefs

Programs

  • PARI
    a(n) = { my (b = binary(n)); forstep (k = 2, #b, 2, if (b[k-1], b[k] = 1-b[k];);); fromdigits(b, 2); }

Formula

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