OFFSET
1,1
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
a(3) = 37 is a term because 37, reverse(37)=73, reverse(2*37)=47 and reverse(2*73)=641 are prime.
MAPLE
rev:= proc(n) local L, k;
L:= convert(n, base, 10);
add(L[-k]*10^(k-1), k=1..nops(L))
end proc:
filter:= proc(n) local r;
if not isprime(n) then return false fi;
r:= rev(n);
isprime(r) and isprime(rev(2*n)) and isprime(rev(2*r))
end proc:
select(filter, [seq(i, i=3..20000, 2)]);
MATHEMATICA
With[{rev = IntegerReverse}, Select[Range[20000], AllTrue[{#, rev[#], rev[2*#], rev[2*rev[#]]}, PrimeQ] &]] (* Amiram Eldar, Oct 10 2020 *)
PROG
(PARI) rev(n) = fromdigits(Vecrev(digits(n))); \\ A004086
isok(p) = if (isprime(p), my(r=rev(p)); isprime(r) && isprime(rev(2*p)) && isprime(rev(2*r))); \\ Michel Marcus, Oct 10 2020
CROSSREFS
KEYWORD
nonn,base
AUTHOR
J. M. Bergot and Robert Israel, Oct 09 2020
STATUS
approved