GATE Computer ScienceVery hardGATE CS (PYQ pattern)

Which of the following unary languages is NOT regular?

  1. A. { a^(k²) : k ≥ 0 }* (Kleene star of the perfect-square lengths)
  2. B. { aⁿ : n is a composite number }
  3. C. { a^(3i + 5j) : i, j ≥ 0 }
  4. D. { aⁿ : the decimal digits of n add up to a multiple of 3 }

Correct answer: B. { aⁿ : n is a composite number }

(squares)* contains a¹, hence equals a*: regular. 3i + 5j produces 0, 3, 5, 6 and every n ≥ 8, an eventually periodic set: regular. The digit sum of n is ≡ n (mod 3), so that language is { aⁿ : 3 | n }: regular. If the composites were regular, so would be a*a* ∖ composites ∩ aa a* = the primes, which are not regular.

More Theory of Computation questions

Exams that ask this topic