// output of ./demo/comb/composition-nz-prefix-cond-demo.cc: // Description: //% Compositions of n into positive parts with restricted prefixes. //% Lexicographic order. arg 1: 7 == n [compositions of n (n>=1)] default=7 arg 2: 5 == c [Condition function: 0 ==> all compositions (condition always true), 1 ==> adjacent digits distinct 2 ==> up-down 3 ==> consecutive parts 4 ==> odd parts 5 ==> growth condition: a[k] <= 2*a[k-1] 6 ==> fall condition: 2*a[k] <= a[k-1] 7 ==> parts are Mersenne numbers 8 ==> parts are Mersenne numbers, partitions 9 ==> parts are powers of 2] default=5 Predicate 5 := cond_growth arg 3: 0 == aa [If aa!=0, render as compositions (1) or fountains of coins (2)] default=0 1: [ 1 1 1 1 1 1 1 ] 2: [ 1 1 1 1 1 2 ] 3: [ 1 1 1 1 2 1 ] 4: [ 1 1 1 2 1 1 ] 5: [ 1 1 1 2 2 ] 6: [ 1 1 2 1 1 1 ] 7: [ 1 1 2 1 2 ] 8: [ 1 1 2 2 1 ] 9: [ 1 1 2 3 ] 10: [ 1 2 1 1 1 1 ] 11: [ 1 2 1 1 2 ] 12: [ 1 2 1 2 1 ] 13: [ 1 2 2 1 1 ] 14: [ 1 2 2 2 ] 15: [ 1 2 3 1 ] 16: [ 1 2 4 ] 17: [ 2 1 1 1 1 1 ] 18: [ 2 1 1 1 2 ] 19: [ 2 1 1 2 1 ] 20: [ 2 1 2 1 1 ] 21: [ 2 1 2 2 ] 22: [ 2 2 1 1 1 ] 23: [ 2 2 1 2 ] 24: [ 2 2 2 1 ] 25: [ 2 2 3 ] 26: [ 2 3 1 1 ] 27: [ 2 3 2 ] 28: [ 2 4 1 ] 29: [ 3 1 1 1 1 ] 30: [ 3 1 1 2 ] 31: [ 3 1 2 1 ] 32: [ 3 2 1 1 ] 33: [ 3 2 2 ] 34: [ 3 3 1 ] 35: [ 3 4 ] 36: [ 4 1 1 1 ] 37: [ 4 1 2 ] 38: [ 4 2 1 ] 39: [ 4 3 ] 40: [ 5 1 1 ] 41: [ 5 2 ] 42: [ 6 1 ] 43: [ 7 ] ct=43