GATE / CS ARCHIVE

GATE CSE 1994 / QUESTION 19(a)

Enumerating maximal runs in pi

Theory of Computation · Decidability & Computability · Full GATE CSE 1994 paper

GATE 1994, Q19(a) MCQ
Report issue

Decidability & Computability

Question 19(a), GATE 1994: Let S be the set of positive integers x for which the decimal expansion of π contains a maximal consecutive run of exactly x digits equal to 5. Which classification is warranted: (i) regular, (ii) recursively enumerable, (iii) not recursively enumerable, (iv) recursive?
Tap to enlarge
Your answer
Answer & solution

Answer: The justified choice is (ii): recursively enumerable. No claim of nonrecursiveness follows. (no official key was published)

π is a computable real, and any finite initial segment of its decimal digits can be calculated effectively. Scan these digits from left to right, keeping the length of the current run of 5s. When a non-5 follows a nonempty run, output its length and reset the counter. Because a completed run has a non-5 immediately on each side (or begins at the start of the fractional digit stream), it is maximal rather than merely a substring of a longer run. Repeated lengths may be printed repeatedly; enumeration does not require uniqueness.

Equivalently, on input x, keep scanning until a completed run of length exactly x appears, then accept. Every positive instance eventually has a finite witness and is accepted. For an absent length the scan may never halt. This establishes recursive enumerability, the warranted answer (ii).

It does not establish that S is nonrecursive. In particular, a hypothetical proof that all finite digit blocks occur in π would make S all positive integers, which is recursive (and regular under customary encodings). Normality of π is not a given and must not be assumed. Nor does failure of this particular search to halt on negative instances prove that no different decision procedure exists. Options (i) and (iv) therefore cannot be inferred merely from the stated computability facts; describing (ii) as the only possible mathematical property would overstate the argument. A regular-language claim additionally needs an encoding of integers.

Original paper, page 6