login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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
Alois P. Heinz, Table of n, a(n) for n = 1..10000 (first 718 terms from Marius A. Burtea)
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
sol; % Marius A. Burtea, Dec 08 2018
(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
print(list(islice(agen(), 46))) # Michael S. Branicky, Sep 23 2022
CROSSREFS
Intersection of A019546 and A046704.
Sequence in context: A355804 A277575 A289754 * A343834 A070029 A360497
KEYWORD
nonn,base,easy
AUTHOR
Amarnath Murthy, Jun 16 2001
EXTENSIONS
Corrected and extended by Larry Reeves (larryr(AT)acm.org), Jun 21 2001
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 20 00:58 EDT 2024. Contains 371798 sequences. (Running on oeis4.)