A377123 Number of subsets of the first n nonzero triangular numbers whose sum is a nonzero triangular number.
1, 2, 4, 5, 8, 13, 18, 29, 48, 81, 136, 228, 420, 747, 1326, 2468, 4520, 8296, 15232, 28196, 52504, 96936, 181699, 340998, 640091, 1207386, 2282956, 4328536, 8211989, 15623003, 29787092, 56831499, 108591159, 207851120, 398222781, 763760138, 1466661416, 2819529654, 5425826011, 10450403468
Offset: 1
Keywords
Examples
a(5) = 8 subsets: {1}, {3}, {6}, {10}, {15}, {6, 15}, {1, 3, 6} and {3, 10, 15}.
Programs
-
Python
from math import isqrt from functools import cache def cond(s): k = 8*s+1; return s > 0 and isqrt(k)**2 == k def u(n): return n*(n+1)//2 @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