A226487
First available increasing palindromes (A002113) found in the decimal expansion of the number e-2 (A001113).
Original entry on oeis.org
7, 8, 818, 2662, 9669, 39193, 94349, 99699, 985589, 988890, 5065605, 6609066, 7193917, 7390937, 8316138, 43488434, 563303365, 799929997, 1149559411, 68088588086, 85367376358, 208532235802, 991964469199
Offset: 1
-
e = RealDigits[E-2, 10, 2500000][[1]]; palQ[n_] := n == Reverse[n]; mx = 0; k = 1; While[k < 1000000, j = 1; While[j <= k, If[ palQ[ Take[ e, {j, k}]], p = FromDigits[ Take[e, {j, k}]]; If[p > mx, mx = p; Print[p]; e = Drop[e, k]; k = 0; Break[]]]; j++]; k++]
A279885
First n-digit palindrome in the decimal expansion of Pi.
Original entry on oeis.org
3, 33, 141, 3993, 46264, 999999, 1736371, 23911932, 398989893, 136776310, 21348884312, 450197791054, 9475082805749, 95715977951759, 697763767367796, 4855796336975584, 42611063036011624, 700015327723510007, 5851405951595041585, 74054579700797545047
Offset: 1
a(2) = 33 because 33 is the first 2-digit palindrome in the decimal expansion of Pi = 3.14159265358979323846264(33)...
-
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 *)
-
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
Showing 1-2 of 2 results.
Comments