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”).

Smallest n-digit prime containing no prime substrings, or 0 if no such number exists.
3

%I #10 Dec 11 2017 02:45:38

%S 2,11,101,1009,10009,100049,1000081,10000169,100000049,1000000009,

%T 10000000069,100000000069,1000000000091,10000000000099,

%U 100000000000099,1000000000000091,10000000000000069,100000000000000049

%N Smallest n-digit prime containing no prime substrings, or 0 if no such number exists.

%C 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

%H Robert Israel, <a href="/A089770/b089770.txt">Table of n, a(n) for n = 1..999</a>

%e 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.

%p N:= 1000: # to get terms until the first where a(n) > 10^(n-1)+10*N+9

%p filter1:= proc(x)

%p local k,j;

%p for k from 0 to ilog10(x) do

%p for j from k to ilog10(x)+1 do

%p if isprime(floor((x mod 10^j)/10^k)) then return false fi;

%p od od:

%p true

%p end proc:

%p X:= select(filter1, [seq(seq(10*i+j,j=[1,9]),i=0..N)]):

%p filter2:= proc(p,x)

%p local k,j;

%p if not isprime(p) then return false fi;

%p for k from 1 to ilog10(x)+1 do

%p if isprime(floor(p /10^k)) then return false fi

%p od;

%p true;

%p end proc:

%p for n from 1 do

%p found:= false;

%p for x in X do

%p p:= 10^(n-1)+x;

%p if filter2(p,x) then A[n]:= p; found:= true; break fi;

%p od:

%p if not found then break fi

%p od:

%p seq(A[i],i=1..n-1); # _Robert Israel_, Dec 09 2017

%Y Cf. A089768, A033274, A089771.

%K base,nonn

%O 1,1

%A _Amarnath Murthy_, Nov 23 2003

%E Corrected and extended by _David Wasserman_, Oct 12 2005