cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

This page as a plain text file.
%I A089770 #10 Dec 11 2017 02:45:38
%S A089770 2,11,101,1009,10009,100049,1000081,10000169,100000049,1000000009,
%T A089770 10000000069,100000000069,1000000000091,10000000000099,
%U A089770 100000000000099,1000000000000091,10000000000000069,100000000000000049
%N A089770 Smallest n-digit prime containing no prime substrings, or 0 if no such number exists.
%C A089770 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 A089770 Robert Israel, <a href="/A089770/b089770.txt">Table of n, a(n) for n = 1..999</a>
%e A089770 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 A089770 N:= 1000: # to get terms until the first where a(n) > 10^(n-1)+10*N+9
%p A089770 filter1:= proc(x)
%p A089770   local k,j;
%p A089770   for k from 0 to ilog10(x) do
%p A089770      for j from k to ilog10(x)+1 do
%p A089770        if isprime(floor((x mod 10^j)/10^k)) then return false fi;
%p A089770   od od:
%p A089770   true
%p A089770 end proc:
%p A089770 X:= select(filter1, [seq(seq(10*i+j,j=[1,9]),i=0..N)]):
%p A089770 filter2:= proc(p,x)
%p A089770     local k,j;
%p A089770     if not isprime(p) then return false fi;
%p A089770     for k from 1 to ilog10(x)+1 do
%p A089770      if isprime(floor(p /10^k)) then return false fi
%p A089770     od;
%p A089770     true;
%p A089770 end proc:
%p A089770 for n from 1 do
%p A089770 found:= false;
%p A089770 for x in X do
%p A089770     p:= 10^(n-1)+x;
%p A089770     if filter2(p,x) then A[n]:= p; found:= true; break fi;
%p A089770 od:
%p A089770 if not found then break fi
%p A089770 od:
%p A089770 seq(A[i],i=1..n-1); # _Robert Israel_, Dec 09 2017
%Y A089770 Cf. A089768, A033274, A089771.
%K A089770 base,nonn
%O A089770 1,1
%A A089770 _Amarnath Murthy_, Nov 23 2003
%E A089770 Corrected and extended by _David Wasserman_, Oct 12 2005