login
A198344
Position of the first n-digit prime occurring in the decimal expansion of Pi, A000796.
4
1, 1, 8, 3, 2, 1, 4, 34, 30, 5, 15, 2, 6, 17, 36, 82, 12, 87, 26, 12, 25, 215, 35, 18, 17, 3, 41, 17, 234, 17, 167, 92, 251, 15, 9, 12, 31, 1, 57, 290, 4, 99, 218, 502, 48, 164, 198, 201, 128, 7, 363, 143, 11, 138, 487, 32, 230, 82, 355, 515, 334, 186, 176, 223
OFFSET
1,3
COMMENTS
Differs from A104842 in a(22), a(43), a(55),..., because here, leading zeros are not allowed.
The corresponding primes are listed in A104841.
Among the first 99 terms, even though values up to 825 occur, the values 1 and 17 occur 4 times, 12 and 57 occur 3 times, and numbers as large as 82, 164, 167 and 234 occur twice.
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..1000 (terms 1..162 from M. F. Hasler)
EXAMPLE
a(1)=1 because the initial digit "3" of Pi is prime.
a(2)=a(6)=a(38)=1 because the first 2, 6, and 38 digits of Pi (including the initial 3) also form the primes 31, 314159 and 31415926535897932384626433832795028841, cf. A005042 and A060421.
MATHEMATICA
With[{pd=RealDigits[Pi, 10, 1000][[1]]}, Table[Position[Partition[pd, n, 1], _?(PrimeQ[FromDigits[#]]&&#[[1]]!=0&), {1}, 1, Heads->False], {n, 60}]]// Flatten (* Harvey P. Dale, Apr 25 2016 *)
PROG
(PARI) A198344(n)=for(c=0, 9e9, ispseudoprime(Pi\.1^(n+c-1)%10^n)&Pi\.1^c%10&return(c+1)) /* Replace upper limit 9e9 by "default(realprecision)-n" to avoid an error message and return 0 in case no n-digit prime is found */
(Python) # uses code in A104841
print([A104841_A198344(n)[1] for n in range(1, 65)]) # Michael S. Branicky, Dec 28 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
M. F. Hasler, Oct 23 2011
STATUS
approved