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

A057889 Bijective bit-reverse of n: keep the trailing zeros in the binary expansion of n fixed, but reverse all the digits up to that point.

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, 29, 24, 19, 22, 27, 28, 23, 30, 31, 32, 33, 34, 49, 36, 41, 50, 57, 40, 37, 42, 53, 52, 45, 58, 61, 48, 35, 38, 51, 44, 43, 54, 59, 56, 39, 46, 55, 60, 47, 62, 63, 64, 65, 66, 97, 68, 81, 98, 113
Offset: 0

Views

Author

Marc LeBrun, Sep 25 2000

Keywords

Comments

The original name was "Bit-reverse of n, including as many leading as trailing zeros." - Antti Karttunen, Dec 25 2024
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). See also A280505.
This is multiplicative in domain GF(2)[X], i.e. with carryless binary arithmetic. A193231 is another such permutation of natural numbers. - Antti Karttunen, Dec 25 2024

Examples

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

Crossrefs

Cf. A030101, A000265, A006519, A006995, A057890, A057891, A280505, A280508, A331166 [= min(n,a(n))], A366378 [k for which a(k) = k (mod 3)], A369044 [= A014963(a(n))].
Similar permutations for other bases: A263273 (base-3), A264994 (base-4), A264995 (base-5), A264979 (base-9).
Other related (binary) permutations: A056539, A193231.
Compositions of this permutation with other binary (or other base-related) permutations: A264965, A264966, A265329, A265369, A379471, A379472.
Compositions with permutations involving prime factorization: A245450, A245453, A266402, A266404, A293448, A366275, A366276.
Other derived permutations: A246200 [= a(3*n)/3], A266351, A302027, A302028, A345201, A356331, A356332, A356759, A366389.
See also A235027 (which is not a permutation).

Programs

  • Mathematica
    Table[FromDigits[Reverse[IntegerDigits[n, 2]], 2]*2^IntegerExponent[n, 2], {n, 71}] (* Ivan Neretin, Jul 09 2015 *)
  • PARI
    A030101(n) = if(n<1,0,subst(Polrev(binary(n)),x,2));
    A057889(n) = if(!n,n,A030101(n/(2^valuation(n,2))) * (2^valuation(n, 2))); \\ Antti Karttunen, Dec 25 2024
  • Python
    def a(n):
        x = bin(n)[2:]
        y = x[::-1]
        return int(str(int(y))+(len(x) - len(str(int(y))))*'0', 2)
    print([a(n) for n in range(101)]) # Indranil Ghosh, Jun 11 2017
    
  • Python
    def A057889(n): return int(bin(n>>(m:=(~n&n-1).bit_length()))[-1:1:-1],2)<Chai Wah Wu, Dec 25 2024
    

Formula

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

Extensions

Clarified the name with May 30 2016 comment from N. J. A. Sloane, and moved the old name to the comments - Antti Karttunen, Dec 25 2024

A356331 Bit-reverse the odd part of the negaFibonacci representation of n: a(n) = A356327(A057889(A215024(n))).

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 17, 10, 11, 12, 13, 14, 15, 19, 9, 18, 16, 20, 21, 51, 44, 24, 38, 26, 32, 28, 45, 46, 31, 27, 33, 34, 35, 36, 48, 25, 39, 40, 49, 53, 43, 23, 29, 30, 47, 37, 41, 50, 22, 52, 42, 54, 55, 140, 133, 58, 106, 115, 79, 62, 113, 127, 99
Offset: 0

Views

Author

Rémy Sigrist, Aug 04 2022

Keywords

Comments

This sequence is a self-inverse permutation of the nonnegative integers similar to A343150, A344682, A345201 and A356332.

Examples

			The first terms, alongside the corresponding negaFibonacci representations, are:
  n   a(n)  nega(n)  nega(a(n))
  --  ----  -------  ----------
   0     0        0           0
   1     1        1           1
   2     2      100         100
   3     3      101         101
   4     4    10010       10010
   5     5    10000       10000
   6     6    10001       10001
   7     7    10100       10100
   8     8    10101       10101
   9    17  1001010     1010010
  10    10  1001000     1001000
  11    11  1001001     1001001
  12    12  1000010     1000010
  13    13  1000000     1000000
  14    14  1000001     1000001
  15    15  1000100     1000100
  16    19  1000101     1010001
  17     9  1010010     1001010
  18    18  1010000     1010000
  19    16  1010001     1000101
  20    20  1010100     1010100
  21    21  1010101     1010101
		

Crossrefs

Programs

  • PARI
    See Links section.

Formula

a(a(n)) = n.
a(n) <= A000045(2*k) iff n <= A000045(2*k).

A356332 Bit-reverse the odd part of the negaFibonacci representation of -n (and negate): a(n) = -A356327(A057889(A215025(n))).

Original entry on oeis.org

0, 1, 2, 3, 4, 10, 6, 7, 8, 9, 5, 11, 12, 31, 27, 23, 16, 17, 28, 19, 20, 21, 22, 15, 24, 30, 26, 14, 18, 29, 25, 13, 32, 33, 86, 82, 65, 71, 38, 78, 61, 57, 42, 51, 44, 45, 72, 83, 74, 62, 50, 43, 75, 53, 54, 55, 56, 41, 58, 77, 70, 40, 49, 63, 64, 36, 79, 85
Offset: 0

Views

Author

Rémy Sigrist, Aug 04 2022

Keywords

Comments

This sequence is a self-inverse permutation of the nonnegative integers similar to A343150, A344682, A345201 and A356331.

Examples

			The first terms, alongside the corresponding negaFibonacci representations, are:
  n   a(n)  nega(-n)  nega(-a(n))
  --  ----  --------  -----------
   0     0         0            0
   1     1        10           10
   2     2      1001         1001
   3     3      1000         1000
   4     4      1010         1010
   5    10    100101       101001
   6     6    100100       100100
   7     7    100001       100001
   8     8    100000       100000
   9     9    100010       100010
  10     5    101001       100101
  11    11    101000       101000
  12    12    101010       101010
  13    31  10010101     10101001
		

Crossrefs

Programs

  • PARI
    See Links section.

Formula

a(a(n)) = n.
a(n) < A000045(2*k+1) iff n < A000045(2*k+1).

A356759 Bit-reverse the odd part of the dual Zeckendorf representation of n: a(n) = A022290(A057889(A003754(n+1))).

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Aug 26 2022

Keywords

Comments

This sequence is a self-inverse permutation of the nonnegative integers, similar to A345201 and A356331.
The dual Zeckendorf (or lazy Fibonacci) representation expresses uniquely a number n as a sum of distinct positive Fibonacci numbers; these distinct Fibonacci numbers can be encoded in binary, and the corresponding binary encoding, A003754(n+1), cannot have two consecutive nonleading 0's.

Examples

			For n = 49:
- the dual Zeckendorf representation of 49 is "1111010",
- reversing its odd part ("111101"), we obtain "1011110",
- so a(49) = 39.
		

Crossrefs

Programs

  • PARI
    See Links section.

Formula

a(a(n)) = n.
a(n) < A000045(k) iff n < A000045(k).

A377477 Consider the nonadjacent form for n, then reverse the digits, leaving any trailing zeros alone, and take the absolute value.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 19, 12, 13, 14, 15, 16, 17, 18, 11, 20, 21, 38, 35, 24, 29, 26, 39, 28, 25, 30, 31, 32, 33, 34, 23, 36, 41, 22, 27, 40, 37, 42, 83, 76, 45, 70, 67, 48, 61, 58, 51, 52, 77, 78, 71, 56, 57, 50, 79, 60, 49, 62, 63, 64, 65, 66, 47
Offset: 0

Views

Author

Rémy Sigrist, Dec 28 2024

Keywords

Comments

A self-inverse permutation of the nonnegative integers.

Examples

			For n = 22: the nonadjacent form for 22 is "10T0T0" (where T denotes -1), reversing the digits and leaving any trailing zeros alone yields "T0T010", so a(22) = |- 2^5 - 2^3 + 2^1| =  38.
		

Crossrefs

See A160652 and A345201 for similar sequences.

Programs

  • PARI
    \\ See Links section.

Formula

A184617(a(n)) = A057889(A184617(n)).

A381618 Reverse the Chung-Graham representation of n while preserving its trailing zeros: a(n) = A381607(A263273(A381608(n))).

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Mar 02 2025

Keywords

Comments

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

Examples

			The first terms, alongside their Chung-Graham representation, are:
  n   a(n)  A381579(n)  A381579(a(n))
  --  ----  ----------  -------------
   0     0           0              0
   1     1           1              1
   2     2           2              2
   3     3          10             10
   4     4          11             11
   5     7          12             21
   6     6          20             20
   7     5          21             12
   8     8         100            100
   9     9         101            101
  10    17         102            201
  11    11         110            110
  12    12         111            111
  13    20         112            211
  14    19         120            210
  15    15         121            121
  16    16         200            200
		

Crossrefs

See A345201 for a similar sequence.

Programs

  • PARI
    A381607(n) = { my (t = Vecrev(digits(n, 3))); sum(k = 1, #t, t[k] * fibonacci(2*k)); }
    A263273(n) = { my (t = 3^if (n, valuation(n, 3), 0)); t * fromdigits(Vecrev(digits(n / t, 3)), 3) }
    A381608(n) = { for (k = 1, oo, my (f = fibonacci(2*k)); if (f >= n, my (v = 0); while (n, while (n >= f, n -= f; v += 3^(k-1);); f = fibonacci(2*k--);); return (v););); }
    a(n) = A381607(A263273(A381608(n)))

Formula

a(n) <= A000045(2*k) iff n <= A000045(2*k).
Showing 1-6 of 6 results.