OFFSET
0,3
COMMENTS
Number of compositions of n into parts with multiplicity <= 3.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..3000
EXAMPLE
a(5) = 15: [5], [4,1], [3,2], [2,3], [1,4], [1,2,2], [2,1,2], [1,1,3], [3,1,1], [2,2,1], [1,3,1], [1,2,1,1], [2,1,1,1], [1,1,2,1], [1,1,1,2].
a(6) = 26: [6], [3,3], [5,1], [4,2], [2,4], [1,5], [4,1,1], [3,2,1], [2,3,1], [1,4,1], [3,1,2], [2,2,2], [1,3,2], [1,2,3], [2,1,3], [1,1,4], [1,2,2,1], [2,1,2,1], [1,1,3,1], [3,1,1,1], [2,2,1,1], [1,3,1,1], [1,2,1,2], [2,1,1,2], [1,1,2,2], [1,1,1,3].
MAPLE
b:= proc(n, i, p) option remember; `if`(n=0, p!, `if`(i<1, 0,
add(b(n-i*j, i-1, p+j)/j!, j=0..min(n/i, 3))))
end:
a:= n-> b(n$2, 0):
seq(a(n), n=0..50);
MATHEMATICA
f[list_]:=Apply[And, Table[Count[list, i]<4, {i, 1, Max[list]}]];
g[list_]:=Length[list]!/Apply[Times, Table[Count[list, i]!, {i, 1, Max[list]}]];
a[n_] := If[n == 0, 1, Total[Map[g, Select[IntegerPartitions[n], f]]]];
Table[a[n], {n, 0, 40}] (* Geoffrey Critzer, Nov 25 2013, updated by Jean-François Alcover, Nov 20 2023 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Nov 24 2013
STATUS
approved