login
A279885
First n-digit palindrome in the decimal expansion of Pi.
1
3, 33, 141, 3993, 46264, 999999, 1736371, 23911932, 398989893, 136776310, 21348884312, 450197791054, 9475082805749, 95715977951759, 697763767367796, 4855796336975584, 42611063036011624, 700015327723510007, 5851405951595041585, 74054579700797545047
OFFSET
1,1
COMMENTS
Numbers can start with 0. For example, a(10) = 0136776310.
The first 6-digit palindrome in the decimal expansion of Pi has all of its digits the same (999999).
No further terms wholly within the first 10^9 digits of Pi. - Michael S. Branicky, Jan 10 2022
EXAMPLE
a(2) = 33 because 33 is the first 2-digit palindrome in the decimal expansion of Pi = 3.14159265358979323846264(33)...
MATHEMATICA
With[{d = First@ RealDigits@ N[Pi, 10^7]}, Table[If[Length@ # == 0, 0, FromDigits@ First@ #] &@ Select[Partition[d, n, 1], # == Reverse@ # &], {n, 13}]] (* Michael De Vlieger, Jan 06 2017 *)
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)[0] for n in range(1, 13)]) # Michael S. Branicky, Jan 10 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Bobby Jacobs, Jan 06 2017
EXTENSIONS
a(8)-a(15) from Michael De Vlieger, Jan 06 2017
a(16)-a(20) from Michael S. Branicky, Jan 10 2022
STATUS
approved