OFFSET
1,1
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
For n = 4, 59 is a twin prime, the reverse of its twin 61 is 16, and |59 - 16| = 43 is a twin prime, so 59 is in the sequence.
MAPLE
digrev:= proc(n) local L, i;
L:= convert(n, base, 10);
add(10^(i-1)*L[-i], i=1..nops(L))
end proc:
filter:= proc(p, q) local t;
t:= abs(p - digrev(q));
isprime(t) and (isprime(t-2) or isprime(t+2))
end proc:
q:= 2: R:= NULL: count:= 0:
while count < 100 do
p:= q; q:= nextprime(q);
if q-p = 2 then
if filter(p, q) then count:= count+1; R:= R, p fi;
if filter(q, p) then count:= count+1; R:= R, q fi;
fi
od:
R;
CROSSREFS
KEYWORD
nonn,base
AUTHOR
J. M. Bergot and Robert Israel, Mar 05 2021
STATUS
approved