// output of ./demo/comb/mset-ksubset-demo.cc: // Description: //% k-subsets (combinations) of a multiset. //% Essentially the same as mixed radix numbers with fixed sum of digits. arg 1: 5 == n [Number of types of elements in multiset] default=5 arg 2: 3 == k [Subsets with k elements] default=3 arg 3: 2 == rr [Multiplicity of elements in multiset: (0==>[1,2,3,...,n])] default=2 args 4,5,... : [Optionally supply multiplicity for all types (rr ignored)] 1: [ 2 1 . . . ] 4 { 0, 0, 1 } 2: [ 1 2 . . . ] 1 { 0, 1, 1 } 3: [ 2 . 1 . . ] 2 { 0, 0, 2 } 4: [ 1 1 1 . . ] 1 { 0, 1, 2 } 5: [ . 2 1 . . ] 1 { 1, 1, 2 } 6: [ 1 . 2 . . ] 2 { 0, 2, 2 } 7: [ . 1 2 . . ] 1 { 1, 2, 2 } 8: [ 2 . . 1 . ] 3 { 0, 0, 3 } 9: [ 1 1 . 1 . ] 1 { 0, 1, 3 } 10: [ . 2 . 1 . ] 1 { 1, 1, 3 } 11: [ 1 . 1 1 . ] 2 { 0, 2, 3 } 12: [ . 1 1 1 . ] 1 { 1, 2, 3 } 13: [ . . 2 1 . ] 2 { 2, 2, 3 } 14: [ 1 . . 2 . ] 3 { 0, 3, 3 } 15: [ . 1 . 2 . ] 1 { 1, 3, 3 } 16: [ . . 1 2 . ] 2 { 2, 3, 3 } 17: [ 2 . . . 1 ] 4 { 0, 0, 4 } 18: [ 1 1 . . 1 ] 1 { 0, 1, 4 } 19: [ . 2 . . 1 ] 1 { 1, 1, 4 } 20: [ 1 . 1 . 1 ] 2 { 0, 2, 4 } 21: [ . 1 1 . 1 ] 1 { 1, 2, 4 } 22: [ . . 2 . 1 ] 2 { 2, 2, 4 } 23: [ 1 . . 1 1 ] 3 { 0, 3, 4 } 24: [ . 1 . 1 1 ] 1 { 1, 3, 4 } 25: [ . . 1 1 1 ] 2 { 2, 3, 4 } 26: [ . . . 2 1 ] 3 { 3, 3, 4 } 27: [ 1 . . . 2 ] 4 { 0, 4, 4 } 28: [ . 1 . . 2 ] 1 { 1, 4, 4 } 29: [ . . 1 . 2 ] 2 { 2, 4, 4 } 30: [ . . . 1 2 ] 3 { 3, 4, 4 } ct=30