Why is $f_1(n)$ not computable but $f_2(n)$ is?

158 Views Asked by At

I have the following two functions, where the first one is not computable and the second one is.

$$f_1(n)= \begin{cases} 1 & ,\text{if in the decimal representation of n appears in the decimal fraction expansion of} \ \pi \\ 0 & ,\text{else} \end{cases} $$

For example, if we have $\pi = 3.1415926 ...$. Then $f_1(14195) = 1$ but we don't know if $f_1(333)$ has a solution.

$$f_2(n)= \begin{cases} 1 & ,\text{if in the decimal representation of pi, there are n many consecutive 7's } \ \\ 0 & ,\text{else} \end{cases} $$

I am having a nightmare trying to understand why one is computable and the other one is not. If we take that $n =3$, then for $f_2$, we are trying to determine if $777$ appears in the decimal representation of $\pi$. But in $f_1$ we already saw that determining if $f(333)$ has a solution is not computable.

How are these two any different?

PS - the $n$ used in $f_1(n)$ is not the same as the one used in $f_2(n)$.

1

There are 1 best solutions below

2
On BEST ANSWER

We start with $f_2(n)$. We have two cases:

Case 1: There are arbitrarily long sequences of consecutive $7$'s in $\pi$, then $f(n)=1, \forall n$, and this is clearly computable.

Case 2: There is a longest sequence of length $k$ of consecutive $7$'s somewhere in $\pi$ and $k$ is fixed. Hence, $$ f_2(n)=\left\{\begin{array}{ll} 1, & \text{if } n \leq k \\ 0, & k < n\end{array}\right. $$ This is also clearly computable.

The function can be generalized (e.g. the apperance of the sequence $333$ is also computable).

$f_1(n)$ on the other hand claims to compute whether or not an arbitrary long sequence of numbers appears in $\pi$ (e.g. $1415926\cdots$). This is a dramatic difference! Now, recapitulate the following definition:

Def.: A (total) function $f: \Sigma^* \to \Sigma^*$ is computable if there is a Turing machine $M$ that halts on every input $\omega$ with $f(\omega)$ as its output on the tape.

For $f_2(n)$, this is clear from the provided cases. Now, for $f_1(n)$ we assume that we have a sequence $\omega$ which is not in $\pi$ (and I do not want to discuss whether or not $\pi$ contains every possible number or not), then there is no way to build a Turing machine which halts on $\omega$ (because in order for our Turing machine to halt, we need to go through all of $\pi$), and therefore $f_1$ is not computable.

Important note for $f_2$: We only proved that $f_2$ is computable. Which function does the actual job is unknown (but also not important for this problem).