A209633 Number of ordered set partitions of the multiset [a,a,1,1,...,1] with two "a" and n "1".
1, 2, 7, 15, 33, 59, 111, 182, 307, 481, 757, 1134, 1713, 2483, 3611, 5117, 7238, 10029, 13888, 18900, 25682, 34442, 46057, 60934, 80428, 105159, 137137, 177495, 229069, 293694, 375582, 477499, 605526, 764060, 961603, 1204898, 1506142, 1875150, 2329185, 2882939
Offset: 0
Keywords
Examples
For n=4 we have the multiset [a,a,1,1,1,1] with the following a(4) = 33 ordered set partitions: For [4] one gets [[1,1,1,1]], [[1,1,1,a]], [[1,1,a,a]]. For [3,1] one gets [[1,1,1],[1]], [[1,1,1],[a]], [[1,1,a],[1]], [[1,1,a],[a]], [[1,a,a],[1]]. For [2,2] one gets [[1,1],[1,1]], [[1,1],[1,a]], [[1,1],[a,a]], [[1,a],[1,1]], [[1,a],[1,a]], [[a,a],[1,1]]. For [2,1,1] one gets [[1,1],[1],[1]], [[1,1],[1],[a]], [[1,1],[a],[1]], [[1,1],[a],[a]], [[1,a],[1],[1]], [[1,a],[1],[a]], [[1,a],[a],[1]], [[a,a],[1],[1]]. For [1,1,1,1] one gets [[1],[1],[1],[1]], [[1],[1],[1],[a]], [[1],[1],[a],[1]], [[1],[1],[a],[a]], [[1],[a],[1],[1]], [[1],[a],[1],[a]], [[1],[a],[a],[1]], [[a],[1],[1],[1]], [[a],[1],[1],[a]], [[a],[1],[a],[1]], [[a],[a],[1],[1]].
Links
- Alois P. Heinz, Table of n, a(n) for n = 0..1000
- Thomas Wieder, Multiselection (2nd approach)
Crossrefs
Cf. A093694.
Programs
-
Maple
p:= (f, g)-> zip((x, y)-> x+y, f, g, 0): b:= proc(n,i) option remember; local f, g; if n=0 then [1, 0, [1]] elif i<1 then [0, 0, [0]] else f:= b(n, i-1); g:= `if`(i>n, [0, 0, [0]], b(n-i, i)); [f[1]+g[1], f[2]+g[2] +`if`(i>1, g[1], 0), p(f[3], [0, g[3][]])] fi end: a:= proc(n) local l, ll; if n=0 then return 1 fi; l:= b(n, n); ll:= l[3]; l[2] +add(ll[t+1] *(1+t* (1+(t-1)/2)), t=1..nops(ll)-1) end: seq(a(n), n=0..50); # Alois P. Heinz, Mar 11 2012
-
Mathematica
zip = With[{m = Max[Length[#1], Length[#2]]}, PadRight[#1, m] + PadRight[#2, m]]&; b[n_, i_] := b[n, i] = Module[{f, g}, Which[n == 0, {1, 0, {1}}, i<1, {0, 0, {0}}, True, f = b[n, i-1]; g = If[i>n, {0, 0, {0}}, b[n-i, i]]; {f[[1]] + g[[1]], f[[2]] + g[[2]] + If[i>1, g[[1]], 0], zip[f[[3]], Join[{0}, g[[3]]]]}]]; a[n_] := Module[{l, ll}, If[n == 0, Return[1]]; l = b[n, n]; ll = l[[3]]; l[[2]] + Sum[ll[[t+1]]*(1+t*(1+(t-1)/2)), {t, 1, Length[ll]-1}]]; Table[a[n], {n, 0, 50}] (* Jean-François Alcover, Feb 13 2017, after Alois P. Heinz *)
Extensions
More terms from Alois P. Heinz, Mar 11 2012
Comments