OFFSET
1,3
COMMENTS
A number n with m digits in base 10 is a member if n is a palindrome, and the first floor(m/2) digits of n is already a previous term of a(n). All repdigit numbers are terms of a(n). Fast generation of new terms with 2m digits can be done by concatenating the previous terms with m digits twice. Fast generation of new terms with 2m+1 digits can be done by concatenating the previous terms with m digits twice with any single digit in the middle. The smallest palindrome which is not a member of a(n) is 1001.
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..10000 (terms 1..1000 from Lior Manor)
EXAMPLE
11011 is in the sequence since it is a palindrome of 5 digits, and the first floor(5/2) digits of it, 11, is also a term. 1001 and 10001 are not in the sequence since 10 is not in the sequence.
PROG
(Python)
from itertools import product
def pals(d, base=10): # all d-digit palindromes as strings
digits = "".join(str(i) for i in range(base))
for p in product(digits, repeat=d//2):
if d//2 > 0 and p[0] == "0": continue
left = "".join(p); right = left[::-1]
for mid in [[""], digits][d%2]: yield left + mid + right
def auptod(dd):
for d in range(1, dd+1):
for p in pals(d//2):
if d//2 == 0: p = ""
elif p[0] == "0": continue
for mid in [[""], "0123456789"][d%2]: yield int(p+mid+p[::-1])
print([rp for rp in auptod(6)]) # Michael S. Branicky, May 22 2021
CROSSREFS
KEYWORD
base,nonn,nice
AUTHOR
Lior Manor, Apr 09 2014
STATUS
approved