GATE Computer ScienceVery hardGATE CS (PYQ pattern)

A 4-bit cyclic Gray code is a cyclic sequence through all sixteen 4-bit words in which consecutive words, including the last and the first, differ in exactly one bit. How many such sequences start with 0000, counting the two directions of traversal as different?

  1. A. 1344
  2. B. 2688
  3. C. 5376
  4. D. 384

Correct answer: B. 2688

This is the number of directed Hamiltonian cycles of the 4-cube through a fixed start vertex. Exhaustive search gives 2688 (1344 undirected cycles). For 3 bits the same count is 12. 384 = 4!·16 counts only the reflected codes obtained by relabelling and complementing bits, which miss most cycles.

More Digital Logic questions

Exams that ask this topic