OFFSET
1,2
COMMENTS
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
a(7)=161 because 1000-161 = 839 and 161839 is prime.
MAPLE
N:= 5: # for terms of <= N digits
digrev:= proc(n) local L, i;
L:= convert(n, base, 10);
add(L[-i]*10^(i-1), i=1..nops(L))
end proc:
Res:= 1, 3, 7, 9:
for d from 2 to N do
if d::even then
m:= d/2;
Res:= Res, seq(seq((i*10^(m-1)+j)*10^m + digrev(i*10^(m-1)+j), j=0..10^(m-1)-1), i=[1, 3, 7, 9]);
else
m:= (d-1)/2;
Res:= Res, seq(seq(seq((i*10^(m-1)+j)*10^(m+1)+y*10^m+digrev(i*10^(m-1)+j), y=0..9), j=0..10^(m-1)-1), i=[1, 3, 7, 9]);
fi
od:
filter:= proc(t) local r;
r:= 10^(ilog10(t)+1)-t;
isprime(t*10^(ilog10(r)+1)+r)
end proc:
select(filter, [Res]); # Robert Israel, Jan 22 2019
CROSSREFS
KEYWORD
base,easy,nonn
AUTHOR
Jason Earls, Jul 25 2005
STATUS
approved