login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A103544
Least n-digit zeroless prime with nonprime digits.
2
11, 149, 1181, 11119, 111119, 1111169, 11111119, 111111181, 1111111181, 11111111449, 111111111149, 1111111111441, 11111111111411, 111111111111691, 1111111111111181, 11111111111111119, 111111111111111161
OFFSET
2,1
LINKS
MAPLE
f:= proc(n) local t, x, L, y;
t:= (10^n-1)/9;
for x from 0 to 5^n-1 do
L:= subs({1=3, 2=5, 3=7, 4=8}, convert(x, base, 5));
y:= t+add(10^(i-1)*L[i], i=1..nops(L));
if isprime(y) then return y fi
od;
FAIL
end proc:
map(f, [$2..20]); # Robert Israel, Sep 28 2018
MATHEMATICA
NextPrim[n_] := Block[{k = n + 1}, While[ !PrimeQ[k], k++ ]; k]; f[n_] := Block[{np = NextPrim[(10^n - 1)/9 - 1]}, While[ Union[ Join[{1, 4, 6, 8, 9}, IntegerDigits[np]]] != {1, 4, 6, 8, 9}, np = NextPrim[np]]; np]; Table[ f[n], {n, 2, 18}] (* Robert G. Wilson v, Mar 23 2005 *)
ndzp[n_]:=Module[{np=NextPrime[FromDigits[PadRight[{}, n, 1]]]}, While[ !SubsetQ[ {1, 4, 6, 8, 9}, IntegerDigits[ np]], np =NextPrime[np]]; np]; Join[{11}, Array[ndzp, 16, 3]] (* Harvey P. Dale, Aug 28 2021 *)
PROG
(Python)
from sympy import isprime
from itertools import product
def a(n):
for p in product("14689", repeat=n):
t = int("".join(p))
if isprime(t): return t
print([a(n) for n in range(2, 22)]) # Michael S. Branicky, Aug 20 2022
CROSSREFS
Sequence in context: A217722 A261536 A175635 * A038141 A307072 A142083
KEYWORD
base,nonn
AUTHOR
Ray G. Opao, Mar 22 2005
EXTENSIONS
More terms from Robert G. Wilson v, Mar 23 2005
STATUS
approved