|
|
A199304
|
|
Palindromic primes in the sense of A007500 with digits '0', '1' and '4' only.
|
|
1
|
|
|
11, 101, 11411, 100411, 101141, 114001, 114041, 140411, 141101, 1004141, 1010411, 1040141, 1041041, 1100441, 1114111, 1140101, 1144441, 1401401, 1410401, 1411141, 1414001, 1440011, 1444411, 1444441, 10010411, 10011101, 10041011, 10044011
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
All terms start and end with the digit 1.
|
|
LINKS
|
|
|
MAPLE
|
F:= proc(d) local A0, A4, Res, q, r;
Res:= NULL;
q:= (10^(d+1)-1)/9;
for A0 in combinat:-powerset({$1..d-1}) do
for A4 in combinat:-powerset({$1..d-1} minus A0) do
r:= q - add(10^i, i=A0) + 3*add(10^i, i=A4);
if isprime(r) and isprime(q - add(10^(d-i), i=A0) + 3*add(10^(d-i), i=A4)) then
Res:= Res, r
fi
od od;
Res
end proc:
|
|
PROG
|
(PARI) allow=Vec("014"); forprime(p=1, default(primelimit), setminus( Set( Vec(Str( p ))), allow)&next; isprime(A004086(p))&print1(p", ")) /* better use the more efficient code below */
(PARI) a(n=50, list=0, L=[0, 1, 4], 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, 4] and IsPrime(Seqint(Reverse(Intseq(p))))]; // Bruno Berselli, Nov 07 2011
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|