combinatorics: gray code and binary counting combinations generation