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

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

A272670 Numbers whose binary expansion is not palindromic but which when reversed and leading zeros omitted, does form a palindrome.

Original entry on oeis.org

2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 24, 28, 30, 32, 34, 36, 40, 42, 48, 54, 56, 60, 62, 64, 66, 68, 72, 80, 84, 90, 96, 102, 108, 112, 120, 124, 126, 128, 130, 132, 136, 144, 146, 160, 168, 170, 180, 186, 192, 198, 204, 214, 216, 224, 238, 240, 248, 252, 254
Offset: 1

Views

Author

N. J. A. Sloane, May 19 2016

Keywords

Comments

Decimal interpretation of A273245. Twice A057890.

Crossrefs

Cf. A006995, A057890, A273245, A273329, subsequence of A154809.

Programs

  • Maple
    isPal := proc(L::list)
        local i;
        for i from 1 to nops(L)/2 do
            if op(i,L) <> op(-i,L) then
                return false;
            end if;
        end do:
        true ;
    end proc:
    isA272670 := proc(n)
        local bdgs ;
        bdgs := convert(n,base,2) ;
        if isPal(bdgs) then
            return false;
        else
            A000265(n) ;
            bdgs := convert(%,base,2) ;
            isPal(bdgs) ;
        end if;
    end proc:
    for n from 1 to 500 do
        if isA272670(n) then
            printf("%d,",n) ;
        end if;
    end do: # R. J. Mathar, May 20 2016
  • Python
    A272670_list = [n for n in range(1,10**4) if bin(n)[2:] != bin(n)[:1:-1] and bin(n)[2:].rstrip('0') == bin(n)[:1:-1].lstrip('0')] # Chai Wah Wu, May 21 2016

A273239 Non-palindromic numbers whose reversal is a palindrome.

Original entry on oeis.org

10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 200, 220, 300, 330, 400, 440, 500, 550, 600, 660, 700, 770, 800, 880, 900, 990, 1000, 1010, 1100, 1110, 1210, 1310, 1410, 1510, 1610, 1710, 1810, 1910, 2000, 2020, 2120, 2200, 2220, 2320, 2420, 2520, 2620, 2720, 2820, 2920
Offset: 1

Views

Author

Giovanni Teofilatto, May 18 2016

Keywords

Comments

Subsequence of A118959. - Altug Alkan, May 18 2016

Crossrefs

Extensions

More terms from Altug Alkan, May 18 2016
Showing 1-3 of 3 results.