GATE Computer ScienceVery hardGATE CSE

A DFA reads a binary string least-significant bit first (so the first symbol read is the 2⁰ bit) and must accept exactly the strings whose numeric value is divisible by 5 (leading/trailing zeros allowed). How many states does the minimal DFA have?

  1. A. 20
  2. B. 5
  3. C. 4
  4. D. 10

Correct answer: B. 5

The natural state is (value mod 5, 2^i mod 5), giving up to 20 pairs, but acceptance after any suffix x depends on r + p·x with p invertible mod 5, i.e. only on r·p⁻¹ mod 5; Moore refinement leaves exactly 5 classes.

More Theory of Computation questions

Exams that ask this topic