Finite Automata

Answer & solution
Official answer: 6
Step through it (2 parts)
Worked explanation
DFA specification: states q0,…,q5; start q0; accepting q2,q4; δ(qr,a)=q((r+1) mod 6); δ(qr,b)=qr. This is a complete transition graph, with an a-cycle of length six and a b-self-loop at each vertex. Counting zero a symbols is divisible by both 2 and 3, so q0 correctly rejects. For minimality, all qr are reached by ar. The accepting suffix exponents modulo 6 for q0…q5 are respectively {2,4},{1,3},{0,2},{1,5},{0,4},{3,5}. These six sets differ pairwise. Choose an exponent in the symmetric difference to distinguish any two states, proving six inequivalent prefixes and the lower bound.
Derivation and answer
Track the number of a symbols modulo 6. On a increment the remainder, on b leave it unchanged, and accept remainders 2 and 4; these are exactly even counts not divisible by 3. All six states are reachable. From remainder r, accepting suffix lengths modulo 6 form {2-r, 4-r}. These six sets are distinct, so any pair of remainders is distinguished by some suffix ak. Myhill-Nerode therefore requires all 6 states, matching the construction.