// output of ./demo/comb/composition-nz-sorts2-pp-demo.cc: // Description: //% Compositions of n into positive parts of s[k] sorts for part (size) k. //% Lexicographic order: major order by parts, minor by sorts, where //% comparison proceeds as part1, sort1; part2, sort2; part3, sort3, etc. //% Loopless algorithm. //% Cf. OEIS sequence A088305 //% compositions of n into one sort of 1's, two sorts of 2's, ..., k sorts of k's. //% Cf. OEIS sequences (compositions of n into (all) parts of s kinds): //% A011782 (s=1), A025192 (s=2), A002001 (s=3), A005054 (s=4), //% A052934 (s=5), A055272 (s=6), A055274 (s=7), and A055275 (s=8). arg 1: 5 == n [compositions of n] default=5 arg 2: 0 == ns [Number of sorts for parts by size (0==>1,2,3,4,...,n)] default=0 args 3,4,... : [Optionally supply number of sorts for all part sizes (ns ignored)] 1: [ 1:0 1:0 1:0 1:0 1:0 ] 2: [ 1:0 1:0 1:0 2:0 ] 3: [ 1:0 1:0 1:0 2:1 ] 4: [ 1:0 1:0 2:0 1:0 ] 5: [ 1:0 1:0 2:1 1:0 ] 6: [ 1:0 1:0 3:0 ] 7: [ 1:0 1:0 3:1 ] 8: [ 1:0 1:0 3:2 ] 9: [ 1:0 2:0 1:0 1:0 ] 10: [ 1:0 2:0 2:0 ] 11: [ 1:0 2:0 2:1 ] 12: [ 1:0 2:1 1:0 1:0 ] 13: [ 1:0 2:1 2:0 ] 14: [ 1:0 2:1 2:1 ] 15: [ 1:0 3:0 1:0 ] 16: [ 1:0 3:1 1:0 ] 17: [ 1:0 3:2 1:0 ] 18: [ 1:0 4:0 ] 19: [ 1:0 4:1 ] 20: [ 1:0 4:2 ] 21: [ 1:0 4:3 ] 22: [ 2:0 1:0 1:0 1:0 ] 23: [ 2:0 1:0 2:0 ] 24: [ 2:0 1:0 2:1 ] 25: [ 2:0 2:0 1:0 ] 26: [ 2:0 2:1 1:0 ] 27: [ 2:0 3:0 ] 28: [ 2:0 3:1 ] 29: [ 2:0 3:2 ] 30: [ 2:1 1:0 1:0 1:0 ] 31: [ 2:1 1:0 2:0 ]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