// output of ./demo/comb/mixedradix-gray2-demo.cc: // Description: //% Mixed radix Gray code, loopless algorithm. //% Implementation following Knuth. arg 1: 3 == n [Number of digits] default=3 arg 2: 4 == rr [Base (radix) of digits (0==>falling factorial, 1==>rising factorial)] default=4 args 3,4,... : [Optionally supply radix for all digits (rr ignored)] Nines: [ 3 3 3 ] 0: [ . . . ] 0 3 +1 f=[ 0 1 2 3 ] 1: [ 1 . . ] 1 0 +1 f=[ 0 1 2 3 ] 2: [ 2 . . ] 2 0 +1 f=[ 0 1 2 3 ] 3: [ 3 . . ] 3 0 +1 f=[ 1 1 2 3 ] 4: [ 3 1 . ] 7 1 +1 f=[ 0 1 2 3 ] 5: [ 2 1 . ] 6 0 -1 f=[ 0 1 2 3 ] 6: [ 1 1 . ] 5 0 -1 f=[ 0 1 2 3 ] 7: [ . 1 . ] 4 0 -1 f=[ 1 1 2 3 ] 8: [ . 2 . ] 8 1 +1 f=[ 0 1 2 3 ] 9: [ 1 2 . ] 9 0 +1 f=[ 0 1 2 3 ] 10: [ 2 2 . ] 10 0 +1 f=[ 0 1 2 3 ] 11: [ 3 2 . ] 11 0 +1 f=[ 1 1 2 3 ] 12: [ 3 3 . ] 15 1 +1 f=[ 0 2 2 3 ] 13: [ 2 3 . ] 14 0 -1 f=[ 0 2 2 3 ] 14: [ 1 3 . ] 13 0 -1 f=[ 0 2 2 3 ] 15: [ . 3 . ] 12 0 -1 f=[ 2 1 2 3 ] 16: [ . 3 1 ] 28 2 +1 f=[ 0 1 2 3 ] 17: [ 1 3 1 ] 29 0 +1 f=[ 0 1 2 3 ] 18: [ 2 3 1 ] 30 0 +1 f=[ 0 1 2 3 ] 19: [ 3 3 1 ] 31 0 +1 f=[ 1 1 2 3 ] 20: [ 3 2 1 ] 27 1 -1 f=[ 0 1 2 3 ] 21: [ 2 2 1 ] 26 0 -1 f=[ 0 1 2 3 ] 22: [ 1 2 1 ] 25 0 -1 f=[ 0 1 2 3 ] 23: [ . 2 1 ] 24 0 -1 f=[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