// output of ./demo/comb/pellgen-gray-demo.cc:
// Description:
//% Gray code for generalized Pell words, recursive CAT algorithm

arg 1: 3 == n  [Length of words]  default=3
arg 2: 3 == r  [Forbidden substrings are [r, x] where x!=0]  default=3
arg 3: 0 == rq  [Whether to reverse order]  default=0
   1:    [ . 3 . ]
   2:    [ . 2 . ]
   3:    [ . 2 1 ]
   4:    [ . 2 2 ]
   5:    [ . 2 3 ]
   6:    [ . 1 3 ]
   7:    [ . 1 2 ]
   8:    [ . 1 1 ]
   9:    [ . 1 . ]
  10:    [ . . . ]
  11:    [ . . 1 ]
  12:    [ . . 2 ]
  13:    [ . . 3 ]
  14:    [ 1 . 3 ]
  15:    [ 1 . 2 ]
  16:    [ 1 . 1 ]
  17:    [ 1 . . ]
  18:    [ 1 1 . ]
  19:    [ 1 1 1 ]
  20:    [ 1 1 2 ]
  21:    [ 1 1 3 ]
  22:    [ 1 2 3 ]
  23:    [ 1 2 2 ]
  24:    [ 1 2 1 ]
  25:    [ 1 2 . ]
  26:    [ 1 3 . ]
  27:    [ 2 3 . ]
  28:    [ 2 2 . ]
  29:    [ 2 2 1 ]
  30:    [ 2 2 2 ]
  31:    [ 2 2 3 ]
  32:    [ 2 1 3 ]
  33:    [ 2 1 2 ]
  34:    [ 2 1 1 ]
  35:    [ 2 1 . ]
  36:    [ 2 . . ]
  37:    [ 2 . 1 ]
  38:    [ 2 . 2 ]
  39:    [ 2 . 3 ]
  40:    [ 3 . 3 ]
  41:    [ 3 . 2 ]
  42:    [ 3 . 1 ]
  43:    [ 3 . . ]
ct=43
