// output of ./demo/comb/mixedradix-modular-gray-demo.cc: // Description: //% Modular mixed radix Gray code. //% Implementation following Knuth (loopless algorithm). 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: [ . . . ] 3 1: [ 1 . . ] 0 2: [ 2 . . ] 0 3: [ 3 . . ] 0 4: [ 3 1 . ] 1 5: [ . 1 . ] 0 6: [ 1 1 . ] 0 7: [ 2 1 . ] 0 8: [ 2 2 . ] 1 9: [ 3 2 . ] 0 10: [ . 2 . ] 0 11: [ 1 2 . ] 0 12: [ 1 3 . ] 1 13: [ 2 3 . ] 0 14: [ 3 3 . ] 0 15: [ . 3 . ] 0 16: [ . 3 1 ] 2 17: [ 1 3 1 ] 0 18: [ 2 3 1 ] 0 19: [ 3 3 1 ] 0 20: [ 3 . 1 ] 1 21: [ . . 1 ] 0 22: [ 1 . 1 ] 0 23: [ 2 . 1 ] 0 24: [ 2 1 1 ] 1 25: [ 3 1 1 ] 0 26: [ . 1 1 ] 0 27: [ 1 1 1 ] 0 28: [ 1 2 1 ] 1 29: [ 2 2 1 ] 0 30: [ 3 2 1 ] 0 31: [ . 2 1 ] 0 32: [ . 2 2 ] 2 33: [ 1 2 2 ] 0 34: [ 2 2 2 ] 0 35: [ 3 2 2 ] 0 36: [ 3 3 2 ] 1 37: [ . 3 2 ] 0 38: [ 1 3 2 ] 0 39: [ 2 3 2 ] 0 40: [ 2 . 2 ] 1 41: [ 3 . 2 ] 0 42: [ . . 2 ] 0 43: [ 1 . 2 ] 0 44: [ 1 1 2 ] 1 45: [ 2 1 2 ] 0 46: [ 3 1 2 ] 0 47: [ . 1 2 ] 0 48: [ . 1 3 ] 2 49: [ 1 1 3 ] 0 50: [ 2 1 3 ] 0 51: [ 3 1 3 ] 0 52: [ 3 2 3 ] 1 53: [ . 2 3 ] 0 54: [ 1 2 3 ] 0 55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