Let be a language with the following alphabet : $\Sigma=\{a,b\}$
I want to write the regular expression of {$w$ | $w$ containing a number of $a$ that we can divide by $3$ }
A friend of mine thought of $(b^*+ab^*aa+aab^*a)^*$ and it seems alright for me but I said to me today that it wasn't true but I can't see why. I havn't found counter examples.
I rather thought of $(b^*ab^*ab^*ab^*)^*$ but I'm not sure. I haven't found counter examples yet.
Therfore, how to have the regular expression of a language with two letters, one which number of instances can be divided by three ?