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.

A280631 Starting position (after the decimal point) of the first n-digit palindrome in the decimal expansion of Pi.

This page as a plain text file.
%I A280631 #31 Jan 10 2022 14:56:09
%S A280631 0,24,1,43,19,762,640,3732,6577,16061,247146,273840,879326,5380812,
%T A280631 10593200,171880711,105176740,517694394,559015193,824827924
%N A280631 Starting position (after the decimal point) of the first n-digit palindrome in the decimal expansion of Pi.
%C A280631 The first 10-digit palindrome in the decimal expansion of Pi (0136776310) first appears at a palindromic position (16061).
%e A280631 a(2) = 24 because the first 2-digit palindrome in the decimal expansion of Pi (33) starts 24 digits after the decimal point.
%e A280631 3.14159265358979323846264(33)...
%t A280631 With[{d = First@ RealDigits@ N[Pi, 10^6]}, Prepend[DeleteCases[Rest@ #, 0], First@ #] &@ Flatten@ Map[If[Length@ # == 0, 0, #[[1, 1]] - 1] &@ SequencePosition[d, #] &, Table[If[Length@ # == 0, {}, First@ #] &@ Select[Partition[d, n, 1], # == Reverse@ # &], {n, 20}]]] (* _Michael De Vlieger_, Jan 07 2017, Version 10.1 *)
%o A280631 (Python)
%o A280631 from sympy import S
%o A280631 # download https://stuff.mit.edu/afs/sipb/contrib/pi/pi-billion.txt, then
%o A280631 # with open('pi-billion.txt', 'r') as f: pi_digits = f.readline()
%o A280631 pi_digits = str(S.Pi.n(3*10**5+2))[:-2] # alternative to above
%o A280631 pi_digits = pi_digits.replace(".", "")
%o A280631 def ispal(s): return s == s[::-1]
%o A280631 def a(n):
%o A280631     for idx in range(len(pi_digits)-n):
%o A280631         if ispal(pi_digits[idx:idx+n]):
%o A280631             return int(pi_digits[idx:idx+n]), idx
%o A280631     return None, None # Not found: Increase number of digits
%o A280631 print([a(n)[1] for n in range(1, 13)]) # _Michael S. Branicky_, Jan 10 2022
%Y A280631 Cf. A000796, A002113, A279885.
%K A280631 nonn,base,more,less
%O A280631 1,2
%A A280631 _Bobby Jacobs_, Jan 06 2017
%E A280631 a(14)-a(15) from _Michael De Vlieger_, Jan 07 2017
%E A280631 a(16)-a(20) from _Michael S. Branicky_, Jan 10 2022