Implement a function \$f\$ (as a function or complete program), such that
\$ \displaystyle\lim_{n\rightarrow \infty} f(n) \$
converges to a number which is not a computable number.
Answers will be scored in bytes with fewer bytes being better.
IO formats
Your answer may be in any of the following formats
- A program or function that takes \$n\$ as input and outputs \$f(n)\$.
- A program or function that takes \$n\$ as input and outputs all \$f(m)\$ where \$m \leq n\$.
- A program or function that outputs successive members of the sequence indefinitely.
Numeric output can be given as any of the following
- An arbitrary precision rational type.
- A pair of arbitrary precision integers representing a numerator and denominator. e.g. \$(2334, 888)\$
- A string representing a rational expressed as a fraction. e.g.
2334/888
- A string representing a rational expressed as a decimal expansion. e.g.
3.141592
Use of fixed precision floating point numbers is unfortunately not accepted. They end up being messy when dealing with limits, I hope the options permitted allow the majority of languages to compete in this challenge relatively unencumbered.
Neither of the fractional outputs are required to be in reduced form.
Examples
Here are some numbers which are not computable, but are computable in the limit. That is any of the following numbers are potential limits for valid solutions to the challenge. This list is obviously not exhaustive.
- The real whose binary expansion encodes the halting problem.
- The real whose binary expansion encodes the busy beaver numbers.
- The real whose binary expansion encodes the truth set of first order logic.
- Chaitin's constant
Example algorithm
The following is an example algorithm which solves the problem by converging to the first example.
Take a positive integer \$n\$ as input. Take the first \$n\$ Turing machines and run each of them for \$n\$ steps. Output
\$ \displaystyle\sum_{m=0}^n \begin{cases}2^{-m}& \text{if machine }m\text{ halted before }n\text{ steps}\\0 & \text{otherwise}\end{cases} \$
That is to say we start at zero and add \$1/2^m\$ for each machine \$m\$ that halts in our simulation.
Now since computing a Turing machine for \$n\$ steps is computable, and adding rational numbers certainly is computable, this algorithm is as a whole computable. However if we take the limit, we get a string that exactly encodes the solutions halting problem. The limit is:
\$ \displaystyle\sum_{m=0}^\infty \begin{cases}2^{-m}& \text{if machine }m\text{ halts}\\0 & \text{otherwise}\end{cases} \$
I think it is intuitive that this sort of thing is not something that can be computed. But more concretely if we were able to compute this number then we could use it to solve the halting problem, which is not possible.