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.

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.

This page as a plain text file.
%I A245571 #80 May 22 2025 10:21:40
%S A245571 31,14159,41,1592653,59,9265358979323,
%T A245571 26535897932384626433832795028841971693993751058209,653,53,35897,5897,
%U A245571 89,97,79,9323,32384626433832795028841971693993751058209749445923078164062862089986280348253421,23,38462643383
%N 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.
%C A245571 a(19) has 3057 digits. - _Robert Israel_, Aug 27 2014
%C A245571 a(20) = 462643. - _Felix Fröhlich_, Aug 30 2014
%C A245571 a(21) has >= 3490 digits, a(22) = 2643383, a(22)-a(42) have 20 or fewer digits. - _Chai Wah Wu_, Sep 24 2014
%e A245571 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 A245571 N:= 1000: # to use up to N+1 digits of pi.
%p A245571 nmax:= 30: # to get up to a(nmax), if possible.
%p A245571 S:= floor(10^N*Pi):
%p A245571 L:= ListTools:-Reverse(convert(S,base,10)):
%p A245571 for n from 1 to nmax do
%p A245571   p:= L[n];
%p A245571   for k1 from n+1 to N+1 do
%p A245571     p:= 10*p + L[k1];
%p A245571     if isprime(p) then break fi
%p A245571   od:
%p A245571   if k1 > N+1 then
%p A245571     A[n]:= "Ran out of digits";
%p A245571     break
%p A245571    else
%p A245571     A[n]:= p
%p A245571   end
%p A245571 od:
%p A245571 seq(A[i],i=1..n-1); # _Robert Israel_, Aug 27 2014
%o A245571 (Python)
%o A245571 from sympy.mpmath import *
%o A245571 from sympy import isprime
%o A245571 def A245571(n):
%o A245571     mp.dps = 1000+n
%o A245571     s = nstr(pi,mp.dps)[:-1].replace('.','')[n-1:]
%o A245571     for i in range(len(s)-1):
%o A245571         p = int(s[:i+2])
%o A245571         if p > 10 and isprime(p):
%o A245571             return p
%o A245571     else:
%o A245571         return 'Ran out of digits'
%o A245571 # _Chai Wah Wu_, Sep 16 2014, corrected _Chai Wah Wu_, Sep 24 2014
%Y A245571 Cf. A000796, A005042, A047777, A076094, A104841, A195834, A198018, A198019, A198187.
%K A245571 nonn,base
%O A245571 1,1
%A A245571 _Felix Fröhlich_, Aug 22 2014