A339442 Number of compositions (ordered partitions) of n into an odd number of distinct triangular numbers.
0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 7, 0, 0, 0, 6, 1, 0, 6, 0, 12, 0, 1, 6, 0, 6, 6, 6, 0, 13, 0, 6, 6, 12, 0, 6, 126, 1, 18, 0, 12, 6, 126, 6, 6, 12, 7, 132, 6, 120, 18, 126, 0, 24, 246, 12, 127, 126, 126, 12, 132, 126, 138, 126, 132, 12, 246, 133, 138, 366, 6, 258, 252
Offset: 0
Keywords
Examples
a(19) = 12 because we have [15, 3, 1] (6 permutations) and [10, 6, 3] (6 permutations).
Links
Programs
-
Maple
b:= proc(n, i, p) option remember; `if`(n=0, irem(p, 2)*p!, (t-> `if`(t>n, 0, b(n, i+1, p)+b(n-t, i+1, p+1)))(i*(i+1)/2)) end: a:= n-> b(n, 1, 0): seq(a(n), n=0..100); # Alois P. Heinz, Dec 05 2020
-
Mathematica
b[n_, i_, p_] := b[n, i, p] = If[n == 0, Mod[p, 2]*p!, With[{t = i(i+1)/2}, If[t > n, 0, b[n, i + 1, p] + b[n - t, i + 1, p + 1]]]]; a[n_] := b[n, 1, 0]; a /@ Range[0, 100] (* Jean-François Alcover, Mar 14 2021, after Alois P. Heinz *)