This question concerns two languages over the alphabet $\Sigma=\{1,-1\}$ (note that this is an alphabet with just two symbols: $1$ and $-1 ).$ The two symbols are interpreted, in the natural way, as the numbers $1$ and $-1,$ in order to define the languages, which are:
- $L_1=\left\{x \in \Sigma^* \mid\right.$ the sum of the numbers in $x$ is divisible by $3\}$
- $L_2=\left\{x \in \Sigma^* \mid\right.$ the sum of the numbers in $x$ is $0\}$.
Thus, for example, the first two words below are in both $L_1$ and $L_2$, whereas the third and fourth are in $L_1$ but not in $L_2$.
$$\epsilon \qquad \quad 1\;1-1\;1-1-1 \qquad \quad1\;1-1\;1\;1-1\;1 \qquad \quad -1-1-1-1\;1$$
Which of the above languages is/are regular?
- Only $\text{L}_1$
- Only $\text{L}_2$
- Both
- None