OFFSET
1,1
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
FORMULA
MAPLE
lpe:= proc(n) local b, d, x;
for d from 1 do
b:= 10^d*n;
for x from b+1 to b+10^d-1 by 2 do
if isprime(x) then return x fi
od
od
end proc:
digrev:= proc(n) local L, i;
L:= convert(n, base, 10);
add(L[-i]*10^(i-1), i=1..nops(L))
end proc:
N:= 4: # to use all palindromes of up to N digits
Res:= seq(lpe(n), n=1..9):
for d from 2 to N do
if d::even then
m:= d/2;
Res:= Res, seq(lpe(n*10^m + digrev(n)), n=10^(m-1)..10^m-1);
else
m:= (d-1)/2;
Res:= Res, seq(seq(lpe(n*10^(m+1)+y*10^m+digrev(n)), y=0..9), n=10^(m-1)..10^m-1);
fi
od:
Res; # Robert Israel, Sep 18 2018
MATHEMATICA
d[n_]:=IntegerDigits[n]; Table[i=1; While[!PrimeQ[x=FromDigits[Flatten[{d[n], d[i]}]]], i=i+2]; x, {n, Select[Range[350], Reverse[x=d[#]]==x &]}] (* Jayanta Basu, May 24 2013 *)
CROSSREFS
KEYWORD
AUTHOR
EXTENSIONS
Corrected by Robert Israel, Sep 18 2018
STATUS
approved