%I #14 Jun 09 2021 08:17:50
%S 6,9,66,99,333,363,393,636,666,696,939,969,999,3333,3663,3993,6336,
%T 6666,6996,9339,9669,9999,30303,30603,30903,33333,33633,33933,36363,
%U 36663,36963,39393,39693,39993,60306,60606,60906,63336,63636,63936
%N Palindromes expressible as the sum of 3 consecutive palindromes.
%H Michael S. Branicky, <a href="/A046498/b046498.txt">Table of n, a(n) for n = 1..15358</a> (all terms with <= 13 digits)
%H Patrick De Geest, <a href="http://www.worldofnumbers.com/index.html">World!Of Numbers</a>
%e 6666 = 2112 + 2222 + 2332.
%o (Python)
%o from itertools import product
%o def ispal(n): s = str(n); return s == s[::-1]
%o def pals(d, base=10): # all d-digit palindromes
%o digits = "".join(str(i) for i in range(base))
%o for p in product(digits, repeat=d//2):
%o if d > 1 and p[0] == "0": continue
%o left = "".join(p); right = left[::-1]
%o for mid in [[""], digits][d%2]: yield int(left + mid + right)
%o def auptod(dd):
%o alst = [6, 9]
%o last3 = [7, 8, 9]
%o for d in range(2, dd+1):
%o for p in pals(d):
%o last3 = last3[1:] + [p]
%o if ispal(sum(last3)): alst.append(sum(last3))
%o return alst
%o print(auptod(5)) # _Michael S. Branicky_, Jun 09 2021
%Y Cf. A002113.
%K nonn,base
%O 1,1
%A _Patrick De Geest_, Sep 15 1998