← RGPV CS-501 (CBGS) Theory of Computation November 2019 Solved Paper
Question
Obtain a regular expression for L = {aˣ | x is divisible by 3 or 5}.
Asked in: CS-501 | November 2019 | 1(b)(ii)
Answer
The expression is (aaa)* + (aaaaa)*. Here + denotes union. The first branch generates a block of three a symbols repeated k times, while the second generates blocks of five.
Every generated length is a multiple of 3 or 5; conversely any nonnegative multiple of either has a corresponding repetition. Length zero is included because zero is divisible by both. If only positive lengths are intended, use aaa(aaa)* + aaaaa(aaaaa)*.
← RGPV CS-501 (CBGS) Theory of Computation November 2019 Solved Paper
Discussion
Ask a question, share your thoughts or report an error.
Sign in to participate in the discussion.
Join the discussion