// output of ./demo/comb/composition-nz-sorts-demo.cc: // Description: //% Compositions of n into positive parts of s sorts. //% Lexicographic order: major order by sorts, minor by parts, where //% comparison proceeds as sort1, part1; sort2, part2; sort3, part3, etc. //% Loopless algorithm. //% Cf. OEIS sequences (compositions of n into 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: 4 == n [compositions of n] default=4 arg 2: 2 == s [number of sorts (s>=1)] default=2 1: [ 1:0 1:0 1:0 1:0 ] 2: [ 1:0 1:0 1:0 1:1 ] 3: [ 1:0 1:0 2:0 ] 4: [ 1:0 1:0 1:1 1:0 ] 5: [ 1:0 1:0 1:1 1:1 ] 6: [ 1:0 1:0 2:1 ] 7: [ 1:0 2:0 1:0 ] 8: [ 1:0 2:0 1:1 ] 9: [ 1:0 3:0 ] 10: [ 1:0 1:1 1:0 1:0 ] 11: [ 1:0 1:1 1:0 1:1 ] 12: [ 1:0 1:1 2:0 ] 13: [ 1:0 1:1 1:1 1:0 ] 14: [ 1:0 1:1 1:1 1:1 ] 15: [ 1:0 1:1 2:1 ] 16: [ 1:0 2:1 1:0 ] 17: [ 1:0 2:1 1:1 ] 18: [ 1:0 3:1 ] 19: [ 2:0 1:0 1:0 ] 20: [ 2:0 1:0 1:1 ] 21: [ 2:0 2:0 ] 22: [ 2:0 1:1 1:0 ] 23: [ 2:0 1:1 1:1 ] 24: [ 2:0 2:1 ] 25: [ 3:0 1:0 ] 26: [ 3:0 1:1 ] 27: [ 4:0 ] 28: [ 1:1 1:0 1:0 1:0 ] 29: [ 1:1 1:0 1:0 1:1 ] 30: [ 1:1 1:0 2:0 ] 31: [ 1:1 1:0 1:1 1:0 ] 32: [ 1:1 1:0 1:1 1:1 ] 33: [ 1:1 1:0 2:1 ] 34: [ 1:1 2:0 1:0 ] 35: [ 1:1 2:0 1:1 ] 36: [ 1:1 3:0 ] 37: [ 1:1 1:1 1:0 1:0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