I need to construct a DFA which accepts the following language: $$ L = \{w \in \{a,b\}^{\ast}\mid \#_{a}(w) \bmod 3 = \#_{b}(w) \bmod 2\} $$ I have no clue how to solve this issue. Can you please help me?
Asked
Active
Viewed 307 times
-1
-
2What have you tried? Where did you get stuck? How would you go about writing a boolean function accepting it in a normal programming language? – Joey Eremondi May 18 '15 at 20:05
-
Start with a simpler problem. For instance: $L = {w \mid w \in \Sigma^{*} ∧ #a(w)\mod 2 = #b(w) \mod 2}$. – André Souza Lemos May 18 '15 at 21:27
-
1possible duplicate of How to prove a language is regular? – Luke Mathieson May 19 '15 at 01:15
1 Answers
3
Hint: Keep track of $\#_a(w) \pmod{3}$ and $\#_b(w) \pmod{2}$, using $3\times 2$ states.

Yuval Filmus
- 276,994
- 27
- 311
- 503
-
By the way, the result can be generalized for any finite number of symbols, and any combination of congruence classes. – André Souza Lemos May 19 '15 at 13:13