%I #78 Nov 02 2019 03:31:22
%S 31,14159,41,1592653,59,9265358979323,
%T 26535897932384626433832795028841971693993751058209,653,53,35897,5897,
%U 89,97,79,9323,32384626433832795028841971693993751058209749445923078164062862089986280348253421,23,38462643383
%N a(n) is the smallest prime number with at least two digits formed by the concatenation of the subsequent digits of Pi, starting at the n-th digit, ignoring the decimal point.
%C a(19) has 3057 digits. - _Robert Israel_, Aug 27 2014
%C a(20) = 462643. - _Felix Fröhlich_, Aug 30 2014
%C a(21) has >= 3490 digits, a(22) = 2643383, a(22)-a(42) have 20 or fewer digits. - _Chai Wah Wu_, Sep 24 2014
%e a(4) = 1592653, because starting at the 4th digit in the expansion, the smallest substring of the digits of Pi forming a prime number is 3.14|1592653|589...
%p N:= 1000: # to use up to N+1 digits of pi.
%p nmax:= 30: # to get up to a(nmax), if possible.
%p S:= floor(10^N*Pi):
%p L:= ListTools:-Reverse(convert(S,base,10)):
%p for n from 1 to nmax do
%p p:= L[n];
%p for k1 from n+1 to N+1 do
%p p:= 10*p + L[k1];
%p if isprime(p) then break fi
%p od:
%p if k1 > N+1 then
%p A[n]:= "Ran out of digits";
%p break
%p else
%p A[n]:= p
%p end
%p od:
%p seq(A[i],i=1..n-1); # _Robert Israel_, Aug 27 2014
%o (Python)
%o from sympy.mpmath import *
%o from sympy import isprime
%o def A245571(n):
%o ....mp.dps = 1000+n
%o ....s = nstr(pi,mp.dps)[:-1].replace('.','')[n-1:]
%o ....for i in range(len(s)-1):
%o ........p = int(s[:i+2])
%o ........if p > 10 and isprime(p):
%o ............return p
%o ....else:
%o ........return 'Ran out of digits'
%o # _Chai Wah Wu_, Sep 16 2014, corrected _Chai Wah Wu_, Sep 24 2014
%Y Cf. A000796, A005042, A047777, A076094, A104841, A195834, A198018, A198019, A198187.
%K nonn,base
%O 1,1
%A _Felix Fröhlich_, Aug 22 2014