OFFSET
1,1
COMMENTS
All terms, except for the initial 5, start and end with the digit '1'. This fact could be used to significantly speed up the given program.
PROG
(PARI) a(n=50, list=0, L=[0, 1, 5], needpal=1)={ for(d=1, 1e9, u=vector(d, i, 10^(d-i))~; forvec(v=vector(d, i, [1+(i==1&!L[1]), #L]), isprime(t=vector(d, i, L[v[i]])*u) || next; needpal & !isprime(A004086(t)) & next; list & print1(t", "); n-- || return(t)))} \\ M. F. Hasler, Nov 06 2011
(Magma) [p: p in PrimesUpTo(10^8) | Set(Intseq(p)) subset [0, 1, 5] and IsPrime(Seqint(Reverse(Intseq(p))))]; // Bruno Berselli, Nov 07 2011
CROSSREFS
KEYWORD
nonn,base
AUTHOR
M. F. Hasler, Nov 06 2011
STATUS
approved