login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A097965
Number of compositions (ordered partitions) of n into n parts, allowing zeros, with distinct nonzero parts.
1
1, 2, 9, 16, 45, 186, 343, 848, 1809, 8290, 13431, 33672, 66157, 143066, 591165, 966016, 2180913, 4281570, 8776423, 15865400, 67586841, 101053282, 226690047, 420479952, 845781625, 1476079826, 2830894353, 10479645568, 15758982597, 33145324410, 60465162751
OFFSET
1,2
LINKS
MAPLE
b:= proc(n, i) option remember; `if`(n=0, [1],
`if`(n>i*(i+1)/2, [], zip((x, y)->x+y, b(n, i-1),
`if`(i>n, [], [0, b(n-i, i-1)[]]), 0)))
end:
a:= proc(n) local l; l:= b(n$2);
add(l[i+1]*i!*binomial(n, i), i=1..nops(l)-1)
end:
seq (a(n), n=1..40); # Alois P. Heinz, Nov 20 2012
MATHEMATICA
zip[f_, x_List, y_List, z_] := With[{m = Max[Length[x], Length[y]]}, Thread[f[PadRight[x, m, z], PadRight[y, m, z]]]]; b[n_, i_] := b[n, i] = If[n == 0, {1}, If[n > i*(i+1)/2, {}, zip[Plus, b[n, i-1], If[i>n, {}, Join[{0}, b[n-i, i-1]]], 0]]]; a[n_] := Module[{l}, l = b[n, n]; Sum[l[[i+1]]*i!*Binomial[n, i], {i, 1, Length[l]-1}]]; Table[a[n], {n, 1, 40}] (* Jean-François Alcover, Jan 29 2014, after Alois P. Heinz *)
CROSSREFS
Sequence in context: A304907 A237282 A178440 * A304974 A075645 A185252
KEYWORD
nonn
AUTHOR
Vladeta Jovovic, Sep 21 2004
STATUS
approved