// output of ./demo/comb/combination-revdoor-demo.cc:
// Description:
//% Combinations in a minimal-change order.
//% Algorithm R, "revolving-door combinations", TAOCP 4A/1, pp.363.
//%  W. H. Payne, F. M. Ives: "Combination Generators",
//%  ACM Transactions on Mathematical Software (TOMS),
//%  vol.5, no.2, pp.163-172, (June-1979).

arg 1: 7 == n  [Combination (n choose k) in minimal-change order: n>=1]  default=7
arg 2: 4 == k  [(n choose k):  1<=k<=n]  default=4
   0:    { 0, 1, 2, 3 }    1111...
   1:    { 0, 1, 3, 4 }    11.11..
   2:    { 1, 2, 3, 4 }    .1111..
   3:    { 0, 2, 3, 4 }    1.111..
   4:    { 0, 1, 2, 4 }    111.1..
   5:    { 0, 1, 4, 5 }    11..11.
   6:    { 1, 2, 4, 5 }    .11.11.
   7:    { 0, 2, 4, 5 }    1.1.11.
   8:    { 2, 3, 4, 5 }    ..1111.
   9:    { 1, 3, 4, 5 }    .1.111.
  10:    { 0, 3, 4, 5 }    1..111.
  11:    { 0, 1, 3, 5 }    11.1.1.
  12:    { 1, 2, 3, 5 }    .111.1.
  13:    { 0, 2, 3, 5 }    1.11.1.
  14:    { 0, 1, 2, 5 }    111..1.
  15:    { 0, 1, 5, 6 }    11...11
  16:    { 1, 2, 5, 6 }    .11..11
  17:    { 0, 2, 5, 6 }    1.1..11
  18:    { 2, 3, 5, 6 }    ..11.11
  19:    { 1, 3, 5, 6 }    .1.1.11
  20:    { 0, 3, 5, 6 }    1..1.11
  21:    { 3, 4, 5, 6 }    ...1111
  22:    { 2, 4, 5, 6 }    ..1.111
  23:    { 1, 4, 5, 6 }    .1..111
  24:    { 0, 4, 5, 6 }    1...111
  25:    { 0, 1, 4, 6 }    11..1.1
  26:    { 1, 2, 4, 6 }    .11.1.1
  27:    { 0, 2, 4, 6 }    1.1.1.1
  28:    { 2, 3, 4, 6 }    ..111.1
  29:    { 1, 3, 4, 6 }    .1.11.1
  30:    { 0, 3, 4, 6 }    1..11.1
  31:    { 0, 1, 3, 6 }    11.1..1
  32:    { 1, 2, 3, 6 }    .111..1
  33:    { 0, 2, 3, 6 }    1.11..1
  34:    { 0, 1, 2, 6 }    111...1
binomial(7, 4)=35
