cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A287994 Position of the first time an n-digit number appears twice in a row after the decimal point of Pi.

This page as a plain text file.
%I A287994 #54 Apr 26 2022 05:01:21
%S A287994 24,413,326,8239,107472,1632152,9719518,106235025
%N A287994 Position of the first time an n-digit number appears twice in a row after the decimal point of Pi.
%C A287994 209209 and 305305 appear in Pi before any 2-digit number appears twice in a row.
%e A287994 a(1) = 24 because the first time a 1-digit number appears twice in a row in the decimal expansion of Pi is 24 digits after the decimal point: 3.14159265358979323846264(33)...
%t A287994 s = First@ RealDigits[Pi,10,10^7]; Table[p = Partition[s,k,1];
%t A287994 SelectFirst[ Range[ Length[p] - k], p[[#]] == p[[# + k]] &] - 1, {k, 7}] (* _Giovanni Resta_, Sep 05 2017 *)
%o A287994 (Python)
%o A287994 from sympy import S
%o A287994 # download https://stuff.mit.edu/afs/sipb/contrib/pi/pi-billion.txt, then
%o A287994 # with open('pi-billion.txt', 'r') as f: pi_digits = f.readline()
%o A287994 pi_digits = str(S.Pi.n(2*10**5))[:-1] # alternative to above
%o A287994 pi_digits = pi_digits.replace(".", "")
%o A287994 def a(n):
%o A287994     idx = 1
%o A287994     while pi_digits[idx:idx+n] != pi_digits[idx+n:idx+2*n]:
%o A287994         idx += 1
%o A287994         assert idx + 2*n < len(pi_digits), "increase precision"
%o A287994     return idx
%o A287994 print([a(n) for n in range(1, 6)]) # _Michael S. Branicky_, Apr 24 2022
%Y A287994 Cf. A000796, A288291, A290977.
%K A287994 nonn,base,more
%O A287994 1,1
%A A287994 _Bobby Jacobs_, Sep 01 2017
%E A287994 a(8) from _Michael S. Branicky_, Apr 24 2022