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

A062019 Erroneous version of A057891.

Original entry on oeis.org

11, 13, 19, 22, 23, 25, 26, 29, 35, 37, 38, 39, 41, 43, 44, 46, 47, 49, 50, 52, 53, 55, 57, 58, 59, 61, 67, 69, 70, 71, 74, 75, 76, 77, 78, 79, 81, 82, 83, 86, 87, 88, 89, 91, 92, 93, 94, 95, 97, 98, 100, 101, 103, 104, 105, 106, 109, 110, 111, 113
Offset: 1

Views

Author

Keywords

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

A057890 In base 2, either a palindrome or becomes a palindrome if trailing 0's are omitted.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 17, 18, 20, 21, 24, 27, 28, 30, 31, 32, 33, 34, 36, 40, 42, 45, 48, 51, 54, 56, 60, 62, 63, 64, 65, 66, 68, 72, 73, 80, 84, 85, 90, 93, 96, 99, 102, 107, 108, 112, 119, 120, 124, 126, 127, 128, 129, 130, 132, 136, 144, 146
Offset: 1

Views

Author

Marc LeBrun, Sep 25 2000

Keywords

Comments

Symmetric bit strings (bit-reverse palindromes), including as many leading as trailing zeros.
Fixed points of A057889, complement of A057891
n such that A000265(n) is in A006995. - Robert Israel, Jun 07 2016

Examples

			10 is included, since 01010 is a palindrome, but 11 is not because 1011 is not.
		

Crossrefs

Programs

  • Haskell
    a057890 n = a057890_list !! (n-1)
    a057890_list = 0 : filter ((== 1) . a178225 . a000265) [1..]
    -- Reinhard Zumkeller, Oct 21 2011
    
  • Maple
    dmax:= 10: # to get all terms < 2^dmax
    revdigs:= proc(n)
      local L, Ln, i;
      L:= convert(n, base, 2);
      Ln:= nops(L);
      add(L[i]*2^(Ln-i), i=1..Ln);
    end proc;
    P[0]:= {0}:
    P[1]:= {1}:
    for d from 2 to dmax do
      if d::even then
        P[d]:= { seq(2^(d/2)*x + revdigs(x), x=2^(d/2-1)..2^(d/2)-1)}
      else
        m:= (d-1)/2;
        B:={seq(2^(m+1)*x + revdigs(x), x=2^(m-1)..2^m-1)};
        P[d]:= B union map(`+`, B, 2^m)
      fi
    od:
    A:= `union`(seq(seq(map(`*`,P[d],2^k),k=0..dmax-d),d=0..dmax)):
    sort(convert(A,list)); # Robert Israel, Jun 07 2016
  • Mathematica
    PaleQ[n_Integer, base_Integer] := Module[{idn, trim = n/base^IntegerExponent[n, base]}, idn = IntegerDigits[trim, base]; idn == Reverse[idn]]; Select[Range[0, 150], PaleQ[#, 2] &] (* Lei Zhou, Dec 13 2013 *)
    pal2Q[n_]:=Module[{id=Drop[IntegerDigits[n,2],-IntegerExponent[n,2]]},id==Reverse[id]]; Join[{0},Select[Range[200],pal2Q]] (* Harvey P. Dale, Feb 26 2015 *)
    A057890Q = If[# > 0 && EvenQ@#, #0[#/2], # == #~IntegerReverse~2] &; Select[0~Range~146, A057890Q] (* JungHwan Min, Mar 29 2017 *)
    Select[Range[0, 200], PalindromeQ[IntegerDigits[#, 2] /. {b__, 0..} -> {b} ]&] (* Jean-François Alcover, Sep 18 2018 *)
  • PARI
    bitrev(n) = subst(Pol(Vecrev(binary(n>>valuation(n,2))), 'x), 'x, 2);
    is(n) = my(x = n >> valuation(n,2)); x == bitrev(x);
    concat(0, select(is,vector(147,n,n)))  \\ Gheorghe Coserea, Jun 07 2016
    
  • PARI
    is(n)=n==0 || Vecrev(n=binary(n>>valuation(n,2)))==n \\ Charles R Greathouse IV, Aug 25 2016
  • Python
    A057890 = [n for n in range(10**6) if bin(n)[2:].rstrip('0') == bin(n)[2:].rstrip('0')[::-1]] # Chai Wah Wu, Aug 12 2014
    

Formula

A030101(A030101(n)) = A030101(n). - David W. Wilson, Jun 09 2009, Jun 18 2009
A178225(A000265(a(n))) = 1. - Reinhard Zumkeller, Oct 21 2011
a(7*2^n-4*n-4) = 4^n + 1, a(10*2^n-4*n-6) = 2*4^n + 1. - Gheorghe Coserea, Apr 05 2017

A061917 Either a palindrome or becomes a palindrome if trailing 0's are omitted.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 20, 22, 30, 33, 40, 44, 50, 55, 60, 66, 70, 77, 80, 88, 90, 99, 100, 101, 110, 111, 121, 131, 141, 151, 161, 171, 181, 191, 200, 202, 212, 220, 222, 232, 242, 252, 262, 272, 282, 292, 300, 303, 313, 323, 330, 333, 343, 353, 363, 373, 383, 393, 400, 404
Offset: 1

Views

Author

N. J. A. Sloane, Jun 27 2001

Keywords

Comments

Numbers that are palindromes when written with a suitable number of leading zeros. - Jeppe Stig Nielsen, Jan 17 2022

Crossrefs

Programs

  • Haskell
    a061917 n = a061917_list !! (n-1)
    a061917_list = filter chi [0..] where
       chi x = zs == reverse zs where
          zs = dropWhile (== '0') $ reverse $ show x
    -- Reinhard Zumkeller, Sep 25 2011
    
  • Mathematica
    PaleQ[n_Integer, base_Integer] := Module[{idn, trim = n/base^IntegerExponent[n, base]}, idn = IntegerDigits[trim, base]; idn == Reverse[idn]]; Select[Range[0, 500], PaleQ[#, 10] &] (* Lei Zhou, Dec 13 2013 *)
    Join[{0},Select[Range[500],PalindromeQ[FromDigits[Drop[IntegerDigits[#],-IntegerExponent[#,10]]]]&]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, May 27 2017 *)
  • PARI
    isOK(k)=k==0||fromdigits(Vecrev(digits(k)))==k/10^valuation(k,10) \\ Jeppe Stig Nielsen, Jan 17 2022
    
  • Python
    def ispal(s): return s == s[::-1]
    def ok(n): s = str(n); return ispal(s) or ispal(s.rstrip('0'))
    print([k for k in range(405) if ok(k)]) # Michael S. Branicky, Jan 17 2022

Formula

A136522(A004151(a(n))) = 1. - Reinhard Zumkeller, Sep 25 2011

Extensions

Corrected by Ray Chandler, Jun 08 2009

A280506 Nonpalindromic part of n in base 2 (with carryless GF(2)[X] factorization): a(n) = A280500(n,A280505(n)).

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 11, 1, 13, 1, 1, 1, 1, 1, 19, 1, 1, 11, 13, 1, 25, 13, 1, 1, 11, 1, 1, 1, 1, 1, 13, 1, 37, 19, 11, 1, 41, 1, 25, 11, 1, 13, 47, 1, 11, 25, 1, 13, 19, 1, 55, 1, 13, 11, 59, 1, 61, 1, 1, 1, 1, 1, 67, 1, 69, 13, 61, 1, 1, 37, 13, 19, 59, 11, 25, 1, 81, 41, 11, 1, 1, 25, 87, 11, 55, 1, 91, 13, 1, 47, 19, 1, 97, 11, 1, 25, 13, 1, 103
Offset: 1

Views

Author

Antti Karttunen, Jan 09 2017

Keywords

Comments

a(n) = number obtained when the maximal base-2 palindromic divisor of n, A280505(n), is divided out of n with carryless GF(2)[X] factorization (see examples of A280500 for the explanation).
Apart from 1, all terms are present in A164861 (form their proper subset).

Crossrefs

Programs

Formula

a(n) = A280500(n,A280505(n)).
Other identities. For all n >= 1:
a(2n) = a(A000265(n)) = a(n).
A048720(a(n), A280505(n)) = n.

Extensions

Erroneous claim removed from comments by Antti Karttunen, May 13 2018

A178226 Characteristic function of A154809 (numbers that are not binary palindromes).

Original entry on oeis.org

0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1
Offset: 0

Views

Author

Jeremy Gardiner, May 23 2010

Keywords

Comments

a(n)=1 if n is in A154809, a(n)=0 otherwise.
Identical to parity of A086757 (Smallest prime p such that n is a palindrome in base p representation)

Crossrefs

Programs

  • Mathematica
    Table[If[IntegerDigits[n,2]==Reverse[IntegerDigits[n,2]],0,1],{n,0,120}] (* Harvey P. Dale, Aug 07 2023 *)
  • PARI
    A178226(n) = (n!=subst(Polrev(binary(n)),x,2)); \\ Antti Karttunen, Dec 15 2017

Formula

a(n) = 1 - A178225(n). - Antti Karttunen, Dec 15 2017

A366379 Numbers k such that A057889(k) != k (mod 3), where A057889 is the bijective bit-reverse.

Original entry on oeis.org

11, 13, 22, 26, 35, 37, 41, 43, 44, 47, 49, 52, 53, 55, 59, 61, 70, 74, 82, 86, 88, 94, 98, 104, 106, 110, 118, 122, 131, 133, 137, 139, 140, 143, 145, 148, 149, 151, 155, 157, 161, 163, 164, 167, 169, 172, 173, 175, 176, 179, 181, 185, 187, 188, 191, 193, 196, 197, 199, 203, 205, 208, 209, 211, 212, 215, 217, 220
Offset: 1

Views

Author

Antti Karttunen, Oct 22 2023

Keywords

Crossrefs

Cf. A030101, A057889, A366378 (complement), A366389.
Subsequence of A001651, and of A057891.

Programs

Showing 1-7 of 7 results.