A338585 Number of partitions of the n-th triangular number into exactly n positive triangular numbers.
1, 1, 0, 0, 1, 2, 3, 4, 9, 16, 29, 52, 92, 173, 307, 554, 1002, 1792, 3216, 5738, 10149, 17942, 31769, 55684, 97478, 170356, 295644, 512468, 886358, 1523779, 2614547, 4476152, 7627119, 12966642, 21988285, 37142199, 62591912, 105215149, 176266155, 294591431
Offset: 0
Keywords
Examples
The 5th triangular number is 15 and 15 = 1 + 1 + 1 + 6 + 6 = 3 + 3 + 3 + 3 + 3, so a(5) = 2.
Links
- Vaclav Kotesovec, Table of n, a(n) for n = 0..300
- Eric Weisstein's World of Mathematics, Triangular Number
- Index to sequences related to polygonal numbers
- Index entries for sequences related to partitions
Crossrefs
Programs
-
Maple
h:= proc(n) option remember; `if`(n<1, 0, `if`(issqr(8*n+1), n, h(n-1))) end: b:= proc(n, i, k) option remember; `if`(n=0, `if`(k=0, 1, 0), `if`(i*k
n, 0, b(n, h(i-1), k)+b(n-i, h(min(n-i, i)), k-1))) end: a:= n-> (t-> b(t, h(t), n))(n*(n+1)/2): seq(a(n), n=0..42); # Alois P. Heinz, Nov 10 2020 -
Mathematica
h[n_] := h[n] = If[n < 1, 0, If[IntegerQ@Sqrt[8n+1], n, h[n-1]]]; b[n_, i_, k_] := b[n, i, k] = If[n == 0, If[k == 0, 1, 0], If[i k < n || k > n, 0, b[n, h[i-1], k] + b[n-i, h[Min[n-i, i]], k-1]]]; a[n_] := b[#, h[#], n]&[n(n+1)/2]; a /@ Range[0, 42](* Jean-François Alcover, Nov 15 2020, after Alois P. Heinz *)
-
SageMath
# Returns a list of length n, slow. def GeneralizedEulerTransform(n, a): R.
= ZZ[[]] f = prod((1 - y*x^a(k) + O(x, y)^a(n)) for k in (1..n)) coeffs = f.inverse().coefficients() coeff = lambda k: coeffs[x^a(k)*y^k] if x^a(k)*y^k in coeffs else 0 return [coeff(k) for k in range(n)] def A338585List(n): return GeneralizedEulerTransform(n, lambda n: n*(n+1)/2) print(A338585List(12)) # Peter Luschny, Nov 12 2020