GATE Computer ScienceHardGATE CS (PYQ pattern)

Let L = { aⁿ : n² ≡ 1 (mod 8) }. How many states does the minimal DFA for L have?

  1. A. 8
  2. B. 4
  3. C. 3
  4. D. 2

Correct answer: D. 2

Every odd n satisfies n² ≡ 1 (mod 8) (1, 9, 25, 49 ≡ 1), and every even n gives n² ≡ 0 or 4. So L is simply the odd-length strings: a 2-state parity DFA. Building an 8-state counter is the trap.

More Theory of Computation questions

Exams that ask this topic