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

%I #25 Sep 23 2022 16:39:09

%S 2,3,5,7,23,223,227,337,353,373,557,577,733,757,773,2333,2357,2377,

%T 2557,2753,2777,3253,3257,3323,3527,3727,5233,5237,5273,5323,5527,

%U 7237,7253,7523,7723,7727,22573,23327,25237,25253,25523,27253,27527,32233,32237,32257

%N Primes with every digit a prime and the sum of the digits a prime.

%H Alois P. Heinz, <a href="/A062088/b062088.txt">Table of n, a(n) for n = 1..10000</a> (first 718 terms from Marius A. Burtea)

%e 2357 is a prime, each digit is a prime and the sum of digits = 17 is also a prime, so 2357 is a term.

%t 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 *)

%o (PARI) isok(p) = isprime(p) && isprime(sumdigits(p)) && (#select(x->(! isprime(x)), digits(p)) == 0); \\ _Michel Marcus_, Dec 08 2018

%o (MATLAB)

%o prim=primes(1000000);

%o m=1;

%o for u=1:100;

%o v=prim(u);

%o nc=dec2base(v,10)-'0';

%o s=sum(nc);

%o if and(isprime(nc)==1,isprime(s)==1)

%o sol(m)=v;

%o m=m+1;

%o end

%o end

%o sol; % _Marius A. Burtea_, Dec 08 2018

%o (Python)

%o from sympy import isprime

%o from itertools import count, islice, product

%o def agen():

%o yield from [2, 3, 5, 7]

%o for d in count(2):

%o for left in product("2357", repeat=d-1):

%o for end in "37":

%o ts = "".join(left) + end

%o if isprime(sum(map(int, ts))):

%o t = int(ts)

%o if isprime(t): yield t

%o print(list(islice(agen(), 46))) # _Michael S. Branicky_, Sep 23 2022

%Y Intersection of A019546 and A046704.

%K nonn,base,easy

%O 1,1

%A _Amarnath Murthy_, Jun 16 2001

%E Corrected and extended by Larry Reeves (larryr(AT)acm.org), Jun 21 2001

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 25 01:35 EDT 2024. Contains 371964 sequences. (Running on oeis4.)