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.

A046498 Palindromes expressible as the sum of 3 consecutive palindromes.

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