GATE Computer ScienceVery hardGATE CS (PYQ pattern)

Let L = { aⁿ : n = 1, or n ≥ 3 and (n ≡ 2 (mod 4) or n ≡ 3 (mod 6)) }. How many states does the minimal DFA for this unary language have?

  1. A. 12
  2. B. 15
  3. C. 13
  4. D. 14

Correct answer: B. 15

Without the exceptions L would be periodic with period lcm(4, 6) = 12 and need a 12-state cycle. Here n = 0, 1, 2 break the period (n = 1 is accepted though 1 is in neither class; n = 2 is rejected though 2 ≡ 2 mod 4), so the tail a⁰, a¹, a² must be kept before the cycle starting at n = 3: 3 + 12 = 15 states.

More Theory of Computation questions

Exams that ask this topic