OFFSET
1,1
COMMENTS
Equivalently, these are palindromes which have a palindromic prefix of length at least 2 and no more than 1 less than half the total length. For example, 7 digit terms have the form (aa)(bcb)(aa) and 8 digit terms are of the form (aa)(bccb)(aa) or (aba)(cc)(aba).
LINKS
James S. DeArmon, Python code
EXAMPLE
110011 is a term since it is a palindrome, and consists of 3 palindromes: (11)(00)(11).
9999999 is a term and its constituent 3 palindromes can be listed in three ways: (99)(999)(99), (999)(99)(99), and (99)(99)(999).
PROG
(Python) # see Link
(Python)
from itertools import count, islice, product
def pals(d=2): # generator of palindromes with d >=2 digits as strings
yield from (f+(s:="".join(r))+m+s[::-1]+f for f in "123456789" for r in product("0123456789", repeat=d//2-1) for m in [[""], "0123456789"][d%2])
def agen(): # generator of terms
yield from (int("".join(p)) for d in count(6) for p in pals(d) if any((s:=p[:i])==s[::-1] for i in range(2, d//2)))
print(list(islice(agen(), 33))) # Michael S. Branicky, Jan 23 2024
CROSSREFS
KEYWORD
base,nonn
AUTHOR
James S. DeArmon, Dec 23 2023
STATUS
approved