VOOZH about

URL: https://oeis.org/A385776

⇱ A385776 - OEIS


login
A385776
Primes having only {1, 2, 9} as digits.
263
2, 11, 19, 29, 191, 199, 211, 229, 911, 919, 929, 991, 1129, 1229, 1291, 1999, 2111, 2129, 2221, 2999, 9199, 9221, 9929, 11119, 11299, 12119, 12211, 12911, 12919, 19121, 19211, 19219, 19919, 19991, 21121, 21191, 21211, 21221, 21911, 21929, 21991
OFFSET
1,1
MATHEMATICA
Flatten[Table[Select[FromDigits /@ Tuples[{1, 2, 9}, n], PrimeQ], {n, 7}]]
PROG
(Magma) [p: p in PrimesUpTo(10^6) | Set(Intseq(p)) subset [1, 2, 9]];
(PARI) primes_with(n=50, show=0, L=[1, 2, 9])={for(d=1, 1e9, my(t, u=vector(d, i, 10^(d-i))~); forvec(v=vector(d, i, [1+!(L[1]||(i>1&&i<d)), #L]), ispseudoprime(t=vecextract(L, v)*u)||next; show&&print1(t", "); n--||return(t)))};
primes_with(, 1, [1, 2, 9])
(Python)
from gmpy2 import is_prime
from itertools import count, islice, product
def primes_with(digits): # generator of primes having only set(digits) as digits
S, E = "".join(sorted(set(digits) - {'0'})), "".join(sorted(set(digits) & set("1379")))
yield from (p for p in [2, 3, 5, 7] if str(p) in digits)
yield from (t for d in count(2) for s in S for m in product(digits, repeat=d-2) for e in E if is_prime(t:=int(s+"".join(m)+e)))
print(list(islice(primes_with("129"), 41))) # Michael S. Branicky, Jul 11 2025
CROSSREFS
Supersequence of A020450, A020457, A020460.
Cf. A000040.
Sequence in context: A386101 A386104 A386022 * A163997 A385192 A067931
KEYWORD
nonn,base,easy
AUTHOR
Jason Bard, Jul 09 2025
STATUS
approved