A173580 Primes where each digit is 0, 1, 2, 4, or 8.
2, 11, 41, 101, 181, 211, 241, 281, 401, 421, 811, 821, 881, 1021, 1181, 1201, 1481, 1801, 1811, 2011, 2081, 2111, 2141, 2221, 2281, 2411, 2441, 2801, 4001, 4021, 4111, 4201, 4211, 4241, 4421, 4441, 4481, 4801, 8011, 8081, 8101, 8111, 8221, 8821, 10111
Offset: 1
Links
- Jason Bard, Table of n, a(n) for n = 1..10000
Programs
-
Maple
with(numtheory): for n from 2 to 10000 do: l:=evalf(floor(ilog10(n))+1): n0:=n:indic:=0:for m from 1 to l do:q:=n0:u:=irem(q,10):v:=iquo(q,10): n0:=v : if u=3 or u= 5 or u= 6 or u=7 or u=9 then indic :=1 :else fi :od :if indic = 0 and type(n,prime) = true then print(n):else fi:od:
-
Mathematica
Join[{2}, Select[Map[FromDigits, Tuples[{0, 1, 2, 4, 8}, 3]]*10 + 1, PrimeQ]] (* Paolo Xausa, Jun 12 2025 *)
-
Python
from sympy import isprime from itertools import count, islice, product def agen(): # generator of terms yield 2 yield from (t for digits in count(2) for f in "1248" for mid in product("01248", repeat=digits-2) if isprime(t:=int(f + "".join(mid) + "1"))) print(list(islice(agen(), 45))) # Michael S. Branicky, Jun 11 2025