login
A245571
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.
1
31, 14159, 41, 1592653, 59, 9265358979323, 26535897932384626433832795028841971693993751058209, 653, 53, 35897, 5897, 89, 97, 79, 9323, 32384626433832795028841971693993751058209749445923078164062862089986280348253421, 23, 38462643383
OFFSET
1,1
COMMENTS
a(19) has 3057 digits. - Robert Israel, Aug 27 2014
a(20) = 462643. - Felix Fröhlich, Aug 30 2014
a(21) has >= 3490 digits, a(22) = 2643383, a(22)-a(42) have 20 or fewer digits. - Chai Wah Wu, Sep 24 2014
EXAMPLE
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...
MAPLE
N:= 1000: # to use up to N+1 digits of pi.
nmax:= 30: # to get up to a(nmax), if possible.
S:= floor(10^N*Pi):
L:= ListTools:-Reverse(convert(S, base, 10)):
for n from 1 to nmax do
p:= L[n];
for k1 from n+1 to N+1 do
p:= 10*p + L[k1];
if isprime(p) then break fi
od:
if k1 > N+1 then
A[n]:= "Ran out of digits";
break
else
A[n]:= p
end
od:
seq(A[i], i=1..n-1); # Robert Israel, Aug 27 2014
PROG
(Python)
from sympy.mpmath import *
from sympy import isprime
def A245571(n):
....mp.dps = 1000+n
....s = nstr(pi, mp.dps)[:-1].replace('.', '')[n-1:]
....for i in range(len(s)-1):
........p = int(s[:i+2])
........if p > 10 and isprime(p):
............return p
....else:
........return 'Ran out of digits'
# Chai Wah Wu, Sep 16 2014, corrected Chai Wah Wu, Sep 24 2014
KEYWORD
nonn,base
AUTHOR
Felix Fröhlich, Aug 22 2014
STATUS
approved