A377122 Number of subsets of the first n nonzero decimal palindromes whose sum is a nonzero decimal palindrome.
1, 3, 7, 14, 23, 31, 40, 54, 78, 125, 219, 416, 865, 1719, 3375, 6646, 13139, 26103, 52029, 103989, 207805, 415509, 828997, 1629345, 3084165, 5525120, 9319815, 14896533, 22847075, 34326110, 51747646, 80304059, 130836329, 225170322, 406349931, 759326388, 1453773251
Offset: 1
Examples
a(5) = 23 subsets: {1}, {2}, {3}, {4}, {5}, {1, 2}, {1, 3}, {1, 4}, {1, 5}, {2, 3}, {2, 4}, {2, 5}, {3, 4}, {3, 5}, {4, 5}, {1, 2, 3}, {1, 2, 4}, {1, 2, 5}, {1, 3, 4}, {1, 3, 5}, {2, 3, 4}, {2, 4, 5} and {1, 2, 3, 5}.
Programs
-
Python
from functools import cache def cond(s): return s > 0 and (w:=str(s)) == w[::-1] def u(n): return A002113(n+1) # uses function in A002113 @cache def b(n, s): if n == 0: return int(cond(s)) return b(n-1, s) + b(n-1, s+u(n)) a = lambda n: b(n, 0) print([a(n) for n in range(1, 51)]) # Michael S. Branicky, Oct 18 2024
Extensions
a(23) and beyond from Michael S. Branicky, Oct 18 2024