OFFSET
1,1
COMMENTS
LINKS
Chai Wah Wu, Table of n, a(n) for n = 1..3004
P. De Geest, World!Of Palindromic Primes
MAPLE
N:= 14: # to get all terms < 3^N
Res:= 2:
digrev:=proc(n) local L;
L:= convert(n, base, 3);
add(L[-i]*3^(i-1), i=1..nops(L))
end proc;
for d from 2 to N do
if d::even then
m:= d/2;
Res:= Res, op(select(isprime, [seq](n*3^m + digrev(n), n=3^(m-1)..3^m-1)));
else
m:= (d-1)/2;
Res:= Res, op(select(isprime, [seq](seq(n*3^(m+1)+y*3^m+digrev(n),
y=0..2), n=3^(m-1)..3^m-1)));
fi
od:
Res; # Robert Israel, Aug 19 2015
MATHEMATICA
Do[s = RealDigits[n, 3][[1]]; If[PrimeQ[n], If[FromDigits[s] == FromDigits[Reverse[s]], Print[n]]], {n, 1, 8500}]
Select[Prime[Range[8300]], Reverse[x = IntegerDigits[#, 3]] == x &] (* Jayanta Basu, Jun 23 2013 *)
PROG
(PARI) lista(nn) = forprime(p=2, nn, if ((d=digits(p, 3)) && (Vecrev(d)==d), print1(p, ", "))); \\ Michel Marcus, Aug 19 2015
CROSSREFS
KEYWORD
nonn,base
AUTHOR
STATUS
approved