login
A104841
The first n-digit prime occurring in the decimal expansion of Pi, A000796.
7
3, 31, 653, 4159, 14159, 314159, 1592653, 28841971, 795028841, 5926535897, 93238462643, 141592653589, 9265358979323, 23846264338327, 841971693993751, 8628034825342117, 89793238462643383, 348253421170679821, 3832795028841971693, 89793238462643383279
OFFSET
1,1
COMMENTS
For the next n-digit primes, see the b-file (link).
Sequence A198344 gives the position of these primes withing the digits of Pi.
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..1000 (terms 1..162 from M. F. Hasler)
PROG
(PARI) default(realprecision, 2000); A104841(n)={for( c=0, default(realprecision)-n-2, Pi\.1^c%10 & ispseudoprime(p=Pi\.1^(n+c-1)%10^n) & return(p)); error("Please increase default(realprecision) to calculate A104841("n").")} \\ M. F. Hasler, Oct 23 2011
(Python)
from sympy import S, isprime
pi = "3"+str(S.Pi.n(10**5))[2:] # or load data from file
def A104841_A198344(n): return next(((p, i+1) for i in range(len(pi)-n) if pi[i]!="0" and isprime(p:=int(pi[i:i+n]))), "not enough digits")
print([A104841_A198344(n)[0] for n in range(1, 21)]) # Michael S. Branicky, Dec 28 2022
CROSSREFS
Sequence in context: A105293 A377746 A368489 * A092552 A322487 A300735
KEYWORD
nonn,base
AUTHOR
Zak Seidov, Mar 27 2005
STATUS
approved