Similar questions 3 more →
Finite Automata

Answer & solution
Answer: Six-state DFA tracking (#a mod 2, #b mod 3); start and only accepting state q00. (no official key was published)
Step through it (2 parts)
The future acceptance of a prefix depends on two remainders, not on the order of its symbols. Let qij mean that the prefix contains i a's modulo 2 and j b's modulo 3. Use Q={q00,q01,q02,q10,q11,q12}; start at q00 and make only q00 accepting. An a toggles i, while a b advances j modulo 3.
State on a on b Accepting? q00 q10 q01 yes q01 q11 q02 no q02 q12 q00 no q10 q00 q11 no q11 q01 q12 no q12 q02 q10 no
This table completely specifies the machine and can be drawn as two three-state b-cycles with paired a-transitions between them. By induction on input length, its state is always the pair of remainders claimed above. Therefore it accepts exactly the required strings, including the empty string because zero is divisible by both divisors.
To prove minimum size, first note that every qij is reachable by ai bj. Next take any distinct qij and qkl. Append the suffix a^((-i) mod 2)b^((-j) mod 3). From qij this reaches q00 and accepts. From qkl it reaches the nonzero remainder pair ((k−i) mod 2,(l−j) mod 3), so it rejects. Every pair of states is thus distinguishable by a common suffix. The six distinct residual languages require at least six DFA states; our six-state construction meets this lower bound. Merely multiplying 2 by 3 would suggest the answer but would not, without distinguishability, prove minimality.