|
|
A037024
|
|
Position of start of first occurrence of prime(n) after the decimal point in expansion of Pi.
|
|
4
|
|
|
6, 9, 4, 13, 94, 110, 95, 37, 16, 186, 137, 46, 2, 23, 119, 8, 4, 219, 98, 39, 299, 13, 26, 11, 12, 852, 3486, 1487, 206, 362, 297, 1096, 859, 525, 2606, 393, 1657, 1410, 1182, 428, 438, 728, 1944, 168, 37, 704, 93, 135, 484, 185, 229, 1688, 1707, 1713, 1006
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
LINKS
|
|
|
EXAMPLE
|
Pi = 3.14159265358979323846264338327950288... (see A000796).
First occurrence of prime(23) = 83 starts at the 26th digit after the decimal point, hence a(23) = 26.
|
|
PROG
|
(Magma) k:=3500; R := RealField(k); [ Position(IntegerToString(Round(10^k*(-3 + Pi(R)))), IntegerToString(NthPrime(n))) : n in [1..55] ]; /* Klaus Brockhaus, Feb 15 2007 */
(Python)
from itertools import takewhile
from sympy import S, prime, primerange
# download https://stuff.mit.edu/afs/sipb/contrib/pi/pi-billion.txt, then
# with open('pi-billion.txt', 'r') as f: pi_digits = f.readline()[1:]
pi_digits = str(S.Pi.n(10**4))[1:] # alternative to above
def aupton(nn):
plocs = (pi_digits.find(str(p)) for p in primerange(2, prime(nn)+1))
return list(takewhile(lambda x: x>=0, plocs)) # until p not found
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|