login
A089770
Smallest n-digit prime containing no prime substrings, or 0 if no such number exists.
3
2, 11, 101, 1009, 10009, 100049, 1000081, 10000169, 100000049, 1000000009, 10000000069, 100000000069, 1000000000091, 10000000000099, 100000000000099, 1000000000000091, 10000000000000069, 100000000000000049
OFFSET
1,1
COMMENTS
For n > 1, a(n) ends in 1 or 9 while other digits can be 0,1,4,6,8 or 9. - Robert Israel, Dec 09 2017
LINKS
EXAMPLE
a(3) = 149 is a term as 1,4,9,14,49 are all nonprimes. 199 is not a member as 19 is a prime.
MAPLE
N:= 1000: # to get terms until the first where a(n) > 10^(n-1)+10*N+9
filter1:= proc(x)
local k, j;
for k from 0 to ilog10(x) do
for j from k to ilog10(x)+1 do
if isprime(floor((x mod 10^j)/10^k)) then return false fi;
od od:
true
end proc:
X:= select(filter1, [seq(seq(10*i+j, j=[1, 9]), i=0..N)]):
filter2:= proc(p, x)
local k, j;
if not isprime(p) then return false fi;
for k from 1 to ilog10(x)+1 do
if isprime(floor(p /10^k)) then return false fi
od;
true;
end proc:
for n from 1 do
found:= false;
for x in X do
p:= 10^(n-1)+x;
if filter2(p, x) then A[n]:= p; found:= true; break fi;
od:
if not found then break fi
od:
seq(A[i], i=1..n-1); # Robert Israel, Dec 09 2017
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Amarnath Murthy, Nov 23 2003
EXTENSIONS
Corrected and extended by David Wasserman, Oct 12 2005
STATUS
approved