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.

A087155 Primes having nontrivial palindromic representation in some (at least one) base.

Original entry on oeis.org

5, 7, 13, 17, 23, 29, 31, 37, 41, 43, 59, 61, 67, 71, 73, 83, 89, 97, 101, 107, 109, 113, 127, 131, 151, 157, 173, 181, 191, 193, 197, 199, 211, 227, 229, 233, 239, 241, 251, 257, 271, 277, 281, 307, 313, 331, 337, 349, 353, 373, 379, 383, 397, 401, 409, 419
Offset: 1

Views

Author

Randy L. Ekl, Oct 18 2003

Keywords

Comments

Number of terms < 10^n: 2, 18, 129, 1010, 8392, ..., . - Robert G. Wilson v, Jun 19 2014
Every whole number has single-digit representation in all large bases and all greater than 2 have representation 11 in the base one less than itself. Other palindromic representations are the nontrivial ones. - James G. Merickel, Jul 25 2015
Primes not in A016038. - Robert Israel, Jul 27 2015

Examples

			17 is in the list because 17_2 = 10001 and 17_4 = 101, two nontrivial palindromic representations. 19 is not in the list because 19 is not a multidigit palindrome in any base other than base 18.
		

Crossrefs

Cf. A016038.

Programs

  • Maple
    filter:= proc(n) local b,L;
    if not isprime(n) then return false fi;
    for b from 2 to floor(sqrt(n)) do
      L:= convert(n,base,b);
      if L = ListTools:-Reverse(L) then return true fi;
    od:
    false
    end proc:
    select(filter, [2*i+1 $ i=1..1000]); # Robert Israel, Jul 27 2015
  • Mathematica
    palindromicBases[n_] := Module[{p}, Table[p = IntegerDigits[n, b]; If[p == Reverse[p], {b, p}, Sequence @@ {}], {b, 2, n - 2}]]; Select[ Prime@ Range@ 300, palindromicBases[#] !={}&] (* Robert G. Wilson v, May 06 2014 *)
  • PARI
    q=1; forprime(m=3,500,count=0; for(b=2,m-1, w=b+1; k=0; i=m; while(i>0,k=k*w+i%b; i=floor(i/b)); l=0; j=k; while(j>0,l=l*w+j%w; j=floor(j/w)); if(l==k,count=count+1; if(count>1,print1(m,", "); q=b; m=nextprime(m+1); q=1; b=1,q=b),)))

Extensions

Title, comments and example changed to agree with convention on single-digit numbers and incorporate 'nontrivial' concept by James G. Merickel, Jul 25 2015