%I #31 Dec 29 2022 09:10:52
%S 3,31,653,4159,14159,314159,1592653,28841971,795028841,5926535897,
%T 93238462643,141592653589,9265358979323,23846264338327,
%U 841971693993751,8628034825342117,89793238462643383,348253421170679821,3832795028841971693,89793238462643383279
%N The first n-digit prime occurring in the decimal expansion of Pi, A000796.
%C For the next n-digit primes, see the b-file (link).
%C Sequence A198344 gives the position of these primes withing the digits of Pi.
%H Michael S. Branicky, <a href="/A104841/b104841.txt">Table of n, a(n) for n = 1..1000</a> (terms 1..162 from M. F. Hasler)
%o (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
%o (Python)
%o from sympy import S, isprime
%o pi = "3"+str(S.Pi.n(10**5))[2:] # or load data from file
%o 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")
%o print([A104841_A198344(n)[0] for n in range(1, 21)]) # _Michael S. Branicky_, Dec 28 2022
%Y Cf. A104819 - A104842.
%Y Cf. A000796, A198344.
%K nonn,base
%O 1,1
%A _Zak Seidov_, Mar 27 2005
|