login
A362678
Primes whose digits are prime and in nondecreasing order.
1
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,1
COMMENTS
Intersection of A009994 and A019546.
The subsequence for primes whose digits are prime and in strictly increasing order has just eight terms: 2 3 5 7 23 37 257 2357 (see A177061).
LINKS
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 *)
PROG
(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
(PARI) isok(p) = if (isprime(p), my(d=digits(p)); (d == vecsort(d)) && (#select(isprime, d) == #d)); \\ Michel Marcus, Jul 07 2023
CROSSREFS
KEYWORD
nonn,base
AUTHOR
James C. McMahon, Jul 03 2023
STATUS
approved