[go: up one dir, main page]

login
A076106
Out of all the n-digit primes, which one takes the longest time to appear in the digits of Pi (ignoring the initial 3)? The answer is a(n), and it appears at position A076130(n).
3
7, 73, 373, 9337, 35569, 805289, 9271903
OFFSET
1,1
COMMENTS
a(8) requires > 1 billion digits of Pi. - Michael S. Branicky, Jul 08 2021
LINKS
Carlos Rivera, Puzzle 40. The Pi Prime Search Puzzle (by Patrick De Geest), The Prime Puzzles and Problems Connection.
EXAMPLE
Of all the 2-digit primes, 11 to 97, the last one to appear in Pi is 73, at position 299 (see A076130). - N. J. A. Sloane, Nov 28 2019
PROG
(Python)
# download https://stuff.mit.edu/afs/sipb/contrib/pi/pi-billion.txt, then
with open('pi-billion.txt', 'r') as f: digits_of_pi = f.readline()[2:]
# from sympy import S
# digits_of_pi = str(S.Pi.n(72*10**4))[2:] # alternate to loading data
from sympy import primerange
global digits_of_pi
bigp, bigloc = None, -1
for p in primerange(10**(n-1), 10**n):
loc = digits_of_pi.find(str(p))
if loc == -1: print("not enough digits", n, p)
if loc > bigloc:
bigloc = loc
bigp = p
return (bigp, bigloc+1)
print([A076106_A076130(n)[0] for n in range(1, 6)]) # Michael S. Branicky, Jul 08 2021
CROSSREFS
KEYWORD
hard,more,nonn,base
AUTHOR
Jean-Christophe Colin (jc-colin(AT)wanadoo.fr), Oct 31 2002
EXTENSIONS
Definition clarified by N. J. A. Sloane, Nov 28 2019
a(7) from Michael S. Branicky, Jul 08 2021
STATUS
approved