GATE Computer ScienceVery hardGATE CS (PYQ pattern)

A serial machine receives an unsigned binary number MSB first, one bit per clock, and must signal whether the number received so far is divisible by 6. What are the minimum numbers of states of a Mealy realisation (output on the transition) and of a Moore realisation (output attached to the state; the empty input counts as 0, which is divisible), respectively?

  1. A. 6 and 6
  2. B. 3 and 4
  3. C. 6 and 7
  4. D. 3 and 3

Correct answer: B. 3 and 4

With remainder r, a new bit gives 2r + b (mod 6), and 2r mod 6 depends only on r mod 3. So remainders r and r + 3 behave identically in the future: a Mealy machine needs only r mod 3 (3 states), its output being [2r + b ≡ 0 (mod 6)]. A Moore state must also show its own output: the class r ≡ 0 (mod 3) splits into remainder 0 (output 1) and 3 (output 0), while classes 1 and 2 need no split: 4 states.

More Digital Logic questions

Exams that ask this topic