%I #11 Aug 29 2018 02:50:01
%S 5,151,11519,2115193,121151939,21211519397,4212115193971,
%T 342121151939719,43421211519397199,2434212115193971993,
%U 224342121151939719937,122434212115193971993787,51224342121151939719937871,2512243421211519397199378719,325122434212115193971993787197,93251224342121151939719937871973
%N a(1) = 5 and then the smallest prime that is obtained by placing digits on both sides of the previous term. Or smallest prime that encompasses a(n-1).
%H Robert Israel, <a href="/A075598/b075598.txt">Table of n, a(n) for n = 1..330</a>
%p f:= proc(n) local m,d,d1,v,x,y,y0,z,found;
%p m:= ilog10(n);
%p v:= infinity;
%p for d from 2 do
%p for d1 from 1 to d-1 do
%p found:= false;
%p for x from 10^(d1-1) to 10^d1-1 while not found do
%p if d-d1=1 then y0:= 1 else y0:= 10^(d-d1-1)+1 fi;
%p for y from y0 to 10^(d-d1)-1 by 2 do
%p z:= y+10^(d-d1)*n + 10^(d-d1+m+1)*x;
%p if isprime(z) then v:= min(v,z); found:= true; break fi
%p od od;
%p od;
%p if v < infinity then return v fi
%p od
%p end proc:
%p A[1]:= 5:
%p for n from 2 to 20 do
%p A[n]:= f(A[n-1])
%p od:
%p seq(A[n],n=1..20); # _Robert Israel_, Aug 28 2018
%Y Cf. A075595, A075596, A075597, A075599, A075600, A075601, A075602.
%K base,nonn
%O 1,1
%A _Amarnath Murthy_, Sep 28 2002
%E More terms from _Sascha Kurz_, Jan 20 2003
%E Terms a(13) and beyond from _Robert Israel_, Aug 28 2018
|