|
|
A280631
|
|
Starting position (after the decimal point) of the first n-digit palindrome in the decimal expansion of Pi.
|
|
1
|
|
|
0, 24, 1, 43, 19, 762, 640, 3732, 6577, 16061, 247146, 273840, 879326, 5380812, 10593200, 171880711, 105176740, 517694394, 559015193, 824827924
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
The first 10-digit palindrome in the decimal expansion of Pi (0136776310) first appears at a palindromic position (16061).
|
|
LINKS
|
Table of n, a(n) for n=1..20.
|
|
EXAMPLE
|
a(2) = 24 because the first 2-digit palindrome in the decimal expansion of Pi (33) starts 24 digits after the decimal point.
3.14159265358979323846264(33)...
|
|
MATHEMATICA
|
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 *)
|
|
PROG
|
(Python)
from sympy import S
# 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()
pi_digits = str(S.Pi.n(3*10**5+2))[:-2] # alternative to above
pi_digits = pi_digits.replace(".", "")
def ispal(s): return s == s[::-1]
def a(n):
for idx in range(len(pi_digits)-n):
if ispal(pi_digits[idx:idx+n]):
return int(pi_digits[idx:idx+n]), idx
return None, None # Not found: Increase number of digits
print([a(n)[1] for n in range(1, 13)]) # Michael S. Branicky, Jan 10 2022
|
|
CROSSREFS
|
Cf. A000796, A002113, A279885.
Sequence in context: A040598 A097190 A103903 * A040599 A076721 A232988
Adjacent sequences: A280628 A280629 A280630 * A280632 A280633 A280634
|
|
KEYWORD
|
nonn,base,more,less
|
|
AUTHOR
|
Bobby Jacobs, Jan 06 2017
|
|
EXTENSIONS
|
a(14)-a(15) from Michael De Vlieger, Jan 07 2017
a(16)-a(20) from Michael S. Branicky, Jan 10 2022
|
|
STATUS
|
approved
|
|
|
|