login
A087155
Primes having nontrivial palindromic representation in some (at least one) base.
3
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,1
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
LINKS
EXAMPLE
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.
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 *)
PROG
(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), )))
CROSSREFS
Cf. A016038.
Sequence in context: A240716 A216773 A216745 * A216753 A045442 A216777
KEYWORD
base,nonn
AUTHOR
Randy L. Ekl, Oct 18 2003
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
STATUS
approved