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

A333777 Inverse permutation to A333776.

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Apr 05 2020

Keywords

Examples

			A333776(90) = 106, hence a(106) = 96.
		

Crossrefs

Cf. A333776.

Programs

  • PARI
    a(n, base=2) = { my (d=Vecrev(digits(n, base)), v=0); forstep (k=#d, 1, -1, v += d[k]*base^(k-1); if (d[k], d=Vecrev(d[1..k-1]))); v }

A333778 Fixed points of A333776.

Original entry on oeis.org

0, 1, 2, 3, 4, 7, 8, 10, 15, 16, 29, 31, 32, 36, 42, 57, 63, 64, 86, 113, 127, 128, 136, 170, 225, 251, 255, 256, 292, 338, 449, 477, 499, 511, 512, 528, 588, 674, 682, 897, 949, 995, 1023, 1024, 1172, 1346, 1390, 1793, 1849, 1893, 1987, 2039, 2047, 2048, 2080
Offset: 1

Views

Author

Rémy Sigrist, Apr 05 2020

Keywords

Comments

This sequence contains A000079, A000225.

Crossrefs

Programs

  • PARI
    is(n, base=2) = { my (d=digits(n, base), t=[]); forstep (k=#d, 1, -1, if (d[k], t=Vecrev(t);); t=concat(d[k], t)); n==fromdigits(t, base) }

A333692 Scan the binary representation of n from left to right; at each 1, reverse the bits to the left and including this 1. The resulting binary representation is that of a(n).

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Apr 04 2020

Keywords

Comments

Leading zeros are ignored.
This sequence is a permutation of the nonnegative integers (as it is injective and preserves the binary length); see A333693 for the inverse.
We can devise a variant of this sequence for any fixed base b > 1, by performing a reversal at each nonzero digit in base b.

Examples

			For n = 90:
- the binary representation of 90 is "1011010",
- this binary representation evolves as follows (parentheses indicate reversals):
   (1)0 1 1 0 1 0
   (1 0 1)1 0 1 0
   (1 1 0 1)0 1 0
   (1 0 1 0 1 1)0
- the resulting binary representation is "1010110"
- and a(90) = 86.
		

Crossrefs

See A333776 for a similar sequence.
Cf. A000120, A030101, A333693 (inverse), A333762 (fixed points).

Programs

  • PARI
    a(n, base=2)={ my (b=digits(n, base), p=[]); for (k=1, #b, p=concat(p, b[k]); if (b[k], p=Vecrev(p))); fromdigits(p, base) }

Formula

a(2*n) = 2*a(n).
a(2*n+1) = A030101(2*a(n)+1).
A000120(a(n)) = A000120(n).

A367307 Reverse bits in blocks in binary expansion of n where blocks are separated by every second 1 bit starting from the most significant 1 bit as the first separator.

Original entry on oeis.org

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

Views

Author

Mikhail Kurkov, Nov 13 2023

Keywords

Comments

Self-inverse permutation of nonnegative integers.

Examples

			For n = 100930, reversals are each (...) block
  n    = 100930 = binary 1(1000)1(0100)1(000010)
  a(n) = 72016  = binary 1(0001)1(0010)1(010000)
		

Crossrefs

Programs

  • PARI
    a(n) = my(v1); v1 = binary(n); my(A = 1); while(A <= #v1, my(B = A, C = 0, D); A++; while(A <= #v1, C += v1[A]; if(v1[A] && (C == 1), D = A); if(C < 2, A++, break)); if(C > 0, v1[D] = 0; v1[A + B - D] = 1)); fromdigits(v1, 2)

Formula

a(n) = b(c(f(n)) + g(n)) = b(h(c(n))) for n > 0 with a(0) = 0 where
b(n) = b(f(h(n))) + g(n) for n > 0 with b(0) = 0,
c(n) = h(c(f(n)) + g(n)) for n > 0 with c(0) = 0,
f(n) = A053645(n), g(n) = A053644(n) and where h(n) = A059893(n).
Note that c (A333776) is the inverse permutation to b (A333777).
a(n) < 2^k iff n < 2^k for k >= 0.
Showing 1-4 of 4 results.