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-10 of 10 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

A266403 Self-inverse permutation of natural numbers: a(n) = A250470(A263273(A250469(n))).

Original entry on oeis.org

1, 2, 5, 4, 3, 8, 17, 6, 13, 10, 11, 20, 9, 14, 71, 22, 7, 26, 19, 12, 23, 16, 21, 24, 41, 18, 53, 28, 31, 56, 29, 38, 107, 58, 67, 74, 61, 32, 197, 40, 25, 68, 59, 50, 137, 64, 73, 62, 49, 44, 227, 76, 27, 80, 55, 30, 89, 34, 43, 66, 37, 48, 91, 46, 69, 60, 35, 42, 65, 70, 15, 78, 47, 36, 119, 52
Offset: 1

Views

Author

Antti Karttunen, Jan 02 2016

Keywords

Crossrefs

Cf. A265369, A265904, A266190, A266401 (other conjugates or similar derivations of A263273).

Programs

Formula

a(n) = A250470(A263273(A250469(n))).
As a composition of related permutations:
a(n) = A266415(A266645(n)) = A266646(A266416(n)).
a(n) = A250472(A264996(A250471(n))).
Other identities. For all n >= 0:
A000035(a(n)) = A000035(n). [This permutation preserves the parity of n.]

A265329 Self-inverse permutation of nonnegative integers: a(n) = A263273(A057889(A263273(n))).

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 17, 12, 19, 26, 15, 16, 11, 18, 13, 20, 21, 22, 55, 24, 25, 14, 27, 28, 65, 30, 67, 32, 39, 38, 35, 36, 37, 34, 33, 40, 145, 42, 73, 100, 45, 46, 61, 48, 79, 226, 219, 76, 121, 54, 23, 56, 57, 70, 59, 60, 47, 82, 63, 64, 29, 66, 31, 68, 81, 58, 217, 72, 43, 74, 75, 52, 193, 174, 49, 80, 69, 62, 221
Offset: 0

Views

Author

Antti Karttunen, Jan 02 2016

Keywords

Crossrefs

Programs

Formula

a(n) = A263273(A057889(A263273(n))).
As a composition of related permutations:
a(n) = A264965(A263273(n)).
a(n) = A263273(A264966(n)).
Other identities. For all n >= 0:
A000035(a(n)) = A000035(n). [This permutation preserves the parity of n.]

A266401 Self-inverse permutation of natural numbers: a(n) = A064989(A263273(A003961(n))).

Original entry on oeis.org

1, 2, 5, 4, 3, 10, 17, 8, 13, 6, 11, 20, 9, 34, 71, 16, 7, 26, 19, 12, 23, 22, 21, 40, 41, 18, 227, 68, 31, 142, 29, 32, 53, 14, 67, 52, 61, 38, 107, 24, 25, 46, 59, 44, 65, 42, 73, 80, 49, 82, 197, 36, 33, 454, 55, 136, 137, 62, 43, 284, 37, 58, 571, 64, 45, 106, 35, 28, 89, 134, 15, 104, 47
Offset: 1

Views

Author

Antti Karttunen, Jan 02 2016

Keywords

Comments

Shift primes in the prime factorization of n one step towards larger primes (A003961), then apply the bijective base-3 reverse (A263273) to the resulting odd number, which yields another (or same) odd number, then shift primes in the prime factorization of that second odd number one step back towards smaller primes (A064989).

Crossrefs

Cf. A265369, A265904, A266190, A266403 (other conjugates or similar sequences derived from A263273).

Programs

  • Mathematica
    f[n_] := Block[{g, h}, g[x_] := x/3^IntegerExponent[x, 3]; h[x_] := x/g@ x; If[n == 0, 0, FromDigits[Reverse@ IntegerDigits[#, 3], 3] &@ g[n] h[n]]]; g[p_?PrimeQ] := g[p] = Prime[PrimePi@ p + 1]; g[1] = 1; g[n_] := g[n] = Times @@ (g[First@ #]^Last@ # &) /@ FactorInteger@ n; h[n_] := Times @@ Power[Which[# == 1, 1, # == 2, 1, True, NextPrime[#, -1]] & /@ First@ #, Last@ #] &@ Transpose@ FactorInteger@ n; Table[h@ f@ g@ n, {n, 82}] (* Michael De Vlieger, Jan 04 2016, after Jean-François Alcover at A003961 and A263273 *)
  • PARI
    A030102(n) = { my(r=[n%3]); while(0M. F. Hasler's Nov 04 2011 code in A030102.
    A263273 = n -> if(!n,n,A030102(n/(3^valuation(n,3))) * (3^valuation(n, 3))); \\ Taking of the quotient probably unnecessary.
    A003961(n) = my(f = factor(n)); for (i=1, #f~, f[i, 1] = nextprime(f[i, 1]+1)); factorback(f); \\ Using code of Michel Marcus
    A064989(n) = {my(f); f = factor(n); if((n>1 && f[1,1]==2), f[1,2] = 0); for (i=1, #f~, f[i,1] = precprime(f[i,1]-1)); factorback(f)};
    A266401 = n -> A064989(A263273(A003961(n)));
    for(n=1, 6560, write("b266401.txt", n, " ", A266401(n)));
    
  • Scheme
    (define (A266401 n) (A064989 (A263273 (A003961 n))))

Formula

a(n) = A064989(A263273(A003961(n))).
As a composition of related permutations:
a(n) = A064216(A264996(A048673(n))).
Other identities. For all n >= 0:
A000035(a(n)) = A000035(n). [This permutation preserves the parity of n.]

A265904 Self-inverse permutation of nonnegative integers: a(n) = A263272(A263273(A263272(n))).

Original entry on oeis.org

0, 1, 2, 3, 4, 11, 6, 29, 8, 9, 10, 5, 12, 13, 38, 33, 92, 17, 18, 83, 20, 87, 110, 35, 24, 89, 26, 27, 28, 7, 30, 37, 32, 15, 86, 23, 36, 31, 14, 39, 40, 119, 114, 281, 44, 99, 254, 65, 276, 335, 98, 51, 260, 71, 54, 245, 56, 249, 326, 101, 60, 263, 74, 261, 272, 47, 330, 353, 116, 105, 278, 53, 72, 251, 62, 267, 332, 107, 78, 269, 80, 81, 82, 19
Offset: 0

Views

Author

Antti Karttunen, Jan 02 2016

Keywords

Comments

A263273 conjugated with the permutation obtained from its even bisection.

Crossrefs

Cf. also A265902.
Cf. A265369, A266190, A266401, A266403 (other conjugates or similar derivations of A263273).

Programs

  • Mathematica
    f[n_] := Block[{g, h}, g[x_] := x/3^IntegerExponent[x, 3]; h[x_] := x/g@ x; If[n == 0, 0, FromDigits[Reverse@ IntegerDigits[#, 3], 3] &@g[n] h[n]]]; t = Table[f[2 n]/2, {n, 0, 1000}]; Table[t[[f[t[[n + 1]]] + 1]], {n, 0, 83}] (* Michael De Vlieger, Jan 04 2016, after Jean-François Alcover at A263273 *)
  • Python
    from sympy import factorint
    from sympy.ntheory.factor_ import digits
    from operator import mul
    def a030102(n): return 0 if n==0 else int(''.join(map(str, digits(n, 3)[1:][::-1])), 3)
    def a038502(n):
        f=factorint(n)
        return 1 if n==1 else reduce(mul, [1 if i==3 else i**f[i] for i in f])
    def a038500(n): return n/a038502(n)
    def a263273(n): return 0 if n==0 else a030102(a038502(n))*a038500(n)
    def a263272(n): return a263273(2*n)/2
    def a(n): return a263272(a263273(a263272(n))) # Indranil Ghosh, May 25 2017
  • Scheme
    (define (A265904 n) (A263272 (A263273 (A263272 n))))
    

Formula

a(n) = A263272(A263273(A263272(n))).
As a composition of related permutations:
a(n) = A263272(A265352(n)).
a(n) = A265351(A263272(n)).
Other identities. For all n >= 0:
a(3*n) = 3*a(n).
A000035(a(n)) = A000035(n). [This permutation preserves the parity of n.]

A266190 Self-inverse permutation of nonnegative integers: a(n) = A264985(A263273(A264985(n))).

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 9, 19, 12, 13, 14, 15, 16, 17, 24, 11, 69, 21, 25, 23, 18, 22, 26, 31, 28, 73, 30, 27, 46, 33, 55, 58, 37, 36, 64, 39, 40, 41, 42, 43, 44, 51, 32, 150, 48, 52, 50, 45, 49, 53, 78, 34, 213, 57, 35, 204, 60, 61, 231, 75, 38, 210, 66, 79, 68, 20, 70, 77, 72, 29, 207, 63, 76, 71, 54, 67, 80, 94, 85, 235
Offset: 0

Views

Author

Antti Karttunen, Jan 02 2016

Keywords

Comments

A263273 conjugated with the permutation obtained from its odd bisection.

Crossrefs

Cf. A265369, A265904, A266401, A266403 (other conjugates or similar derivations of A263273).
Cf. also A266189.

Programs

  • Mathematica
    f[n_] := Block[{g, h}, g[x_] := x/3^IntegerExponent[x, 3]; h[x_] := x/g@ x; If[n == 0, 0, FromDigits[Reverse@ IntegerDigits[#, 3], 3] &@ g[n] h[n]]]; s = Select[f /@ Range@ 5000, OddQ]; t = Table[(s[[n + 1]] - 1)/2, {n, 0, 1000}]; Table[t[[f[t[[n + 1]]] + 1]], {n, 0, 83}] (* Michael De Vlieger, Jan 04 2016, after Jean-François Alcover at A263273 *)
  • Scheme
    (define (A266190 n) (A264985 (A263273 (A264985 n))))

Formula

a(n) = A264985(A263273(A264985(n))).
As a composition of related permutations:
a(n) = A265353(A264985(n)).
a(n) = A264985(A265354(n)).

A266641 Permutation of nonnegative integers: a(n) = A264965(2*n) / 2.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 11, 8, 9, 10, 13, 12, 7, 14, 15, 32, 23, 18, 35, 20, 33, 26, 19, 24, 29, 38, 27, 28, 17, 30, 37, 16, 21, 34, 113, 36, 41, 50, 87, 40, 31, 42, 77, 104, 45, 110, 101, 96, 25, 22, 69, 68, 95, 54, 47, 56, 39, 86, 83, 60, 59, 74, 99, 92, 65, 114, 97, 44, 81, 70, 49, 72, 89, 82, 75, 88, 73, 66, 121, 80, 51
Offset: 0

Views

Author

Antti Karttunen, Jan 04 2016

Keywords

Crossrefs

Formula

a(n) = A264965(2*n) / 2.
As a composition of related permutations:
a(n) = A263272(A057889(n)).

A266642 Permutation of nonnegative integers: a(n) = A264966(2*n) / 2.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 13, 8, 9, 10, 7, 12, 11, 14, 15, 32, 29, 18, 23, 20, 33, 50, 17, 24, 49, 22, 27, 28, 25, 30, 41, 16, 21, 34, 19, 36, 31, 26, 57, 40, 37, 42, 125, 68, 45, 106, 55, 96, 71, 38, 81, 88, 89, 54, 101, 56, 117, 118, 61, 60, 83, 82, 99, 116, 65, 78, 119, 52, 51, 70, 113, 72, 77, 62, 75, 92, 43, 114, 107, 80, 69
Offset: 0

Views

Author

Antti Karttunen, Jan 04 2016

Keywords

Crossrefs

Programs

Formula

a(n) = A264966(2*n) / 2.
As a composition of related permutations:
a(n) = A057889(A263272(n)).

A266643 Permutation of nonnegative integers: a(n) = A264965(3*n) / 3.

Original entry on oeis.org

0, 1, 2, 3, 4, 7, 6, 5, 8, 9, 10, 19, 12, 11, 22, 21, 16, 25, 18, 13, 20, 15, 14, 27, 24, 73, 58, 23, 28, 39, 30, 37, 64, 57, 46, 17, 36, 67, 26, 55, 40, 31, 66, 49, 76, 51, 54, 65, 48, 41, 50, 75, 44, 163, 34, 29, 56, 77, 78, 61, 60, 53, 74, 45, 32, 59, 42, 43, 68, 81, 70, 33, 72, 35, 82, 63, 52, 71, 38, 47, 80, 69
Offset: 0

Views

Author

Antti Karttunen, Jan 04 2016

Keywords

Crossrefs

Formula

a(n) = A264965(3*n) / 3.
As a composition of related permutations:
a(n) = A263273(A246200(n)).

A266644 Permutation of nonnegative integers: a(n) = A264966(3*n) / 3.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Jan 04 2016

Keywords

Crossrefs

Inverse: A266643.
Differs from A264965 for the first time at n=17, where a(17) = 35, while A264965(17) = 25.

Programs

Formula

a(n) = A264966(3*n) / 3.
As a composition of related permutations:
a(n) = A246200(A263273(n)).
Showing 1-10 of 10 results.