OFFSET
0,1
COMMENTS
LINKS
Ronald R. King and T. D. Noe, Table of n, a(n) for n = 0..9999
Dave Andersen, The Pi-Search Page.
Tom Crawford and Brady Haran, Strings and Loops within Pi, Numberphile video (2020)
Anders Hellström, Sage program, Feb 02 2017
EXAMPLE
In the decimal expansion of Pi, the string "0" is found at position 32 counting from the first digit after the decimal point. The string "1" is found at position 1, the string "2" at position 6, the string "3" at position 9, etc.
MATHEMATICA
Table[-1 + SequencePosition[#, IntegerDigits@ n][[1, 1]], {n, 0, 68}] &@ First@ RealDigits@ N[Pi, 10^4] (* Michael De Vlieger, Aug 10 2016, Version 10.1 *)
PROG
(Magma) k := 700; R := RealField(k); [ Position(IntegerToString(Round(10^k*(-3 + Pi(R)))), IntegerToString(n)) : n in [0..68] ]; /* Klaus Brockhaus, Feb 15 2007 */
(PARI) M14777=Map(); A014777(n)={iferr(mapget(M14777, n), E, my(i=if(n>9, A014777(n\10), 1), d=if(n, digits(n), [0]), j); while(i++, j=#d; until(!j, d[j]==A000796(i+j--) || next(2)); break); mapput(M14777, n, i--); i)} \\ M. F. Hasler, Jun 21 2022
(Python)
from mpmath import mp
def A014777(n):
if not (i := A014777.pos.get(n, 0)):
d = str(n); s = 2 # starting position for search
while (i := A014777.pi.find(d, s)) < 1:
s = max(len(A014777.pi) - len(d), 2)
with mp.workdps(s + 99 if s < 500 else s*6//5): # new precision
A014777.pi = str(mp.pi - 5/mp.mpf(10)**mp.dps) # don't round
i -= 1; A014777.pos[n] = i
return i
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Paul Simon (paulsimn(AT)microtec.net) and Simon Plouffe
EXTENSIONS
More terms from Klaus Brockhaus, Feb 15 2007
STATUS
approved