|
|
A062088
|
|
Primes with every digit a prime and the sum of the digits a prime.
|
|
11
|
|
|
2, 3, 5, 7, 23, 223, 227, 337, 353, 373, 557, 577, 733, 757, 773, 2333, 2357, 2377, 2557, 2753, 2777, 3253, 3257, 3323, 3527, 3727, 5233, 5237, 5273, 5323, 5527, 7237, 7253, 7523, 7723, 7727, 22573, 23327, 25237, 25253, 25523, 27253, 27527, 32233, 32237, 32257
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
LINKS
|
|
|
EXAMPLE
|
2357 is a prime, each digit is a prime and the sum of digits = 17 is also a prime, so 2357 is a term.
|
|
MATHEMATICA
|
aQ[p_] := PrimeQ[p] && Module[{d = IntegerDigits[p]}, PrimeQ[Total[d]] && LengthWhile[d, PrimeQ[#] &] == Length[d]]; Select[Range[33000], aQ] (* Amiram Eldar, Dec 08 2018 *)
|
|
PROG
|
(PARI) isok(p) = isprime(p) && isprime(sumdigits(p)) && (#select(x->(! isprime(x)), digits(p)) == 0); \\ Michel Marcus, Dec 08 2018
(MATLAB)
prim=primes(1000000);
m=1;
for u=1:100;
v=prim(u);
nc=dec2base(v, 10)-'0';
s=sum(nc);
if and(isprime(nc)==1, isprime(s)==1)
sol(m)=v;
m=m+1;
end
end
(Python)
from sympy import isprime
from itertools import count, islice, product
def agen():
yield from [2, 3, 5, 7]
for d in count(2):
for left in product("2357", repeat=d-1):
for end in "37":
ts = "".join(left) + end
if isprime(sum(map(int, ts))):
t = int(ts)
if isprime(t): yield t
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base,easy
|
|
AUTHOR
|
|
|
EXTENSIONS
|
Corrected and extended by Larry Reeves (larryr(AT)acm.org), Jun 21 2001
|
|
STATUS
|
approved
|
|
|
|