A386047 Primes having only {0, 2, 4, 7} as digits.
2, 7, 47, 227, 277, 727, 2027, 2207, 2447, 2477, 2707, 2777, 4007, 4027, 4447, 7027, 7207, 7247, 7477, 7727, 20047, 20407, 20477, 20707, 20747, 22027, 22247, 22277, 22447, 22727, 22777, 24007, 24077, 24247, 24407, 27077, 27277, 27407, 27427, 40277, 40427, 42227
Offset: 1
Links
Programs
-
Magma
[p: p in PrimesUpTo(10^6) | Set(Intseq(p)) subset [0, 2, 4, 7]];
-
Maple
f:= n-> (l-> add([0, 2, 4, 7][l[j]+1]*10^(j-1), j=1..nops(l)))(convert(n, base, 4)): select(isprime, [seq(f(i), i=0..600)])[]; # Alois P. Heinz, Jul 15 2025
-
Mathematica
Select[FromDigits /@ Tuples[{0, 2, 4, 7}, n], PrimeQ]
-
PARI
primes_with(, 1, [0, 2, 4, 7]) \\ uses function in A385776
-
Python
print(list(islice(primes_with("0247"), 41))) # uses function/imports in A385776