// output of ./demo/comb/composition-nz-gray-demo.cc: // Description: //% Compositions of n into positive parts. //% Gray code with moves of only one unit, all moves are one-close or //% two-close, two-close moves always cross a part =1 and all moves are //% at the end, involving the last element. //% Loopless algorithm. //% First composition has one part for all n. //% See Joerg Arndt, Subset-lex: did we miss an order?, (2014) //% http://arxiv.org/abs/1405.6503 arg 1: 7 == n [compositions of n] default=7 arg 2: 0 == aa [Whether to render as ASCII art] default=0 0: 111111 [ 7 ] 1: 11111. [ 6 1 ] 2: 1111.. [ 5 1 1 ] 3: 1111.1 [ 5 2 ] 4: 111.11 [ 4 3 ] 5: 111.1. [ 4 2 1 ] 6: 111... [ 4 1 1 1 ] 7: 111..1 [ 4 1 2 ] 8: 11..11 [ 3 1 3 ] 9: 11..1. [ 3 1 2 1 ] 10: 11.... [ 3 1 1 1 1 ] 11: 11...1 [ 3 1 1 2 ] 12: 11.1.. [ 3 2 1 1 ] 13: 11.1.1 [ 3 2 2 ] 14: 11.11. [ 3 3 1 ] 15: 11.111 [ 3 4 ] 16: 1.1111 [ 2 5 ] 17: 1.111. [ 2 4 1 ] 18: 1.11.. [ 2 3 1 1 ] 19: 1.11.1 [ 2 3 2 ] 20: 1.1.11 [ 2 2 3 ] 21: 1.1.1. [ 2 2 2 1 ] 22: 1.1... [ 2 2 1 1 1 ] 23: 1.1..1 [ 2 2 1 2 ] 24: 1...11 [ 2 1 1 3 ] 25: 1...1. [ 2 1 1 2 1 ] 26: 1..... [ 2 1 1 1 1 1 ] 27: 1....1 [ 2 1 1 1 2 ] 28: 1..1.. [ 2 1 2 1 1 ] 29: 1..1.1 [ 2 1 2 2 ] 30: 1..11. [ 2 1 3 1 ] 31: 1..111 [ 2 1 4 ] 32: ..1111 [ 1 1 5 ] 33: ..111. [ 1 1 4 1 ] 34: ..11.. [ 1 1 3 1 1 ] 35: ..11.1 [ 1 1 3 2 ] 36: ..1.11 [ 1 1 2 3 ] 37: ..1.1. [ 1 1 2 2 1 ] 38: ..1... [ 1 1 2 1 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