login
Primes that contain only the digits (2, 3, 5).
3

%I #19 Dec 04 2022 13:06:38

%S 2,3,5,23,53,223,233,353,523,2333,3253,3323,3533,5233,5323,5333,23333,

%T 25253,25523,32233,32323,32353,32533,33223,33353,33533,35323,35353,

%U 35533,52223,52253,52553,53233,53323,53353,55333,222323,222533,222553,223253,225223

%N Primes that contain only the digits (2, 3, 5).

%C The digits are prime numbers excluding 7.

%H Michael S. Branicky, <a href="/A214703/b214703.txt">Table of n, a(n) for n = 1..10000</a> (terms 1..1000 from Vincenzo Librandi)

%t Flatten[Table[Select[FromDigits/@Tuples[{2,3,5},n],PrimeQ],{n,7}]]

%o (Magma) [p: p in PrimesUpTo(300000) | Set(Intseq(p)) subset [2,3,5]];

%o (Python)

%o from sympy import isprime

%o from itertools import count, islice, product

%o def agen(): yield from (k for d in count(1) for k in (int("".join(p)) for p in product("235", repeat=d)) if isprime(k))

%o print(list(islice(agen(), 41))) # _Michael S. Branicky_, Dec 04 2022

%Y Subsequence of A019546.

%Y Cf. A087363 (primes with only prime digits excluding 2).

%K nonn,base,easy

%O 1,1

%A _Vincenzo Librandi_, Jul 28 2012