Multiple choice

If s is a string over (0 + 1)* then let n0 (s) denote the number of 0's in s and n1 (s) the number of 1's in s. Which one of the following languages is not regular?

  1. L = {s $\in$(0 + 1)*| n0 (s) is a 3-digit prime}
  2. L = {s $\in$(0 + 1)*| for every prefix s' of s1 |n0 (s') - n1 (s')| $\le$2 |
  3. L = {s $\in$(0 + 1)*| n0 (s') - n1 (s')| $\le$4 |
  4. L = {s $\in$(0 + 1)*| n0 (s) mod 7 = n1 (s) mod 5 = 0}
Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation