number of ’s in divisible by but not divisible by
The minimum number of states in DFA that accepts is _________
View worked solution
Answer: 6
Let denote the number of ’s in the string . The language is defined as:
This condition can be analyzed modulo (since ):
- is divisible by if .
- is divisible by if .
For to be divisible by but not by , we must have:
Thus, the language only depends on the count of ’s modulo . We can construct a DFA with states, , where state represents . The start state is and the set of accepting states is . Since transitions on do not change the state, we only transition on to the next state modulo .
To verify if any states can be merged, we test pairwise distinguishability. For any two states and (), we can find a string of ’s of length that distinguishes them (i.e., drives one to an accepting state and the other to a non-accepting state). Since all states are pairwise distinguishable, the DFA is already minimal.
Therefore, the minimum number of states in the DFA is 6.
Free practice · Your answers on this page are not saved.
