A362678 Primes whose digits are prime and in nondecreasing order.
2, 3, 5, 7, 23, 37, 223, 227, 233, 257, 277, 337, 557, 577, 2237, 2333, 2357, 2377, 2557, 2777, 3557, 5557, 22277, 22777, 23333, 23357, 23557, 25577, 33377, 33577, 222337, 222557, 223337, 223577, 233357, 233557, 233777, 235577, 333337, 335557, 355777
Offset: 1
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..10000
Programs
-
Maple
M:= 7: # for terms with <+ M digits R:= NULL: for d from 1 to M do S:= NULL: for x2 from 0 to d do for x3 from 0 to d-x2 do for x5 from 0 to d-x2-x3 do x7:= d-x2-x3-x5; x:= parse(cat(2$x2,3$x3,5$x5,7$x7)); if isprime(x) then S:= S,x fi; od od od; R:= R, op(sort([S])); od: R; # Robert Israel, Jul 04 2023
-
Mathematica
Select[Prime[Range[31000]], AllTrue[d = IntegerDigits[#], PrimeQ] && LessEqual @@ d &] (* Amiram Eldar, Jul 07 2023 *)
-
PARI
isok(p) = if (isprime(p), my(d=digits(p)); (d == vecsort(d)) && (#select(isprime, d) == #d)); \\ Michel Marcus, Jul 07 2023
-
Python
from sympy import isprime from itertools import count, combinations_with_replacement as cwr, islice def agen(): yield from (filter(isprime, (int("".join(c)) for d in count(1) for c in cwr("2357",d)))) print(list(islice(agen(), 50))) # Michael S. Branicky, Jul 05 2023
Comments