GATE Computer ScienceHardGATE CS (PYQ pattern)

How many 10-bit unsigned values x (0 to 1023) have no two adjacent 1 bits, where bit 9 and bit 0 also count as adjacent (the bits are arranged in a circle)?

  1. A. 144
  2. B. 110
  3. C. 123
  4. D. 89

Correct answer: C. 123

Without the wrap-around condition the count is F(12) = 144 (strings of length n with no 11 number F(n+2)). Subtract those with bit 9 = bit 0 = 1: then bits 8 and 1 are forced to 0 and bits 2..7 (6 bits) are free of 11, F(8) = 21 strings. 144 - 21 = 123, the Lucas number L(10).

More Programming and Data Structures (GATE) questions

Exams that ask this topic