rev:= proc(n) local L, t;
L:= convert(n, base, 10);
add(L[-t]*10^(t-1), t=1..nops(L));
end proc:
g:= proc(n) local x, n, r;
t:= 0; x:= n;
do
r:= rev(x);
if r = x or not isprime(x) or not isprime(r) then return t fi;
t:= t+1;
x:= 2*x - r;
od
end proc:
V:= Vector(5): count:= 0:
for n from 13 by 2 while count < 5 do
v:= g(n);
if v > 0 and V[v] = 0 then
V[v]:= n; count:= count+1
fi
od:
convert(V, list);
|