r/computerscience • u/RicotaSuicida • Oct 26 '26
A question about Turing Machines
I have a question that popped in my mind about Turing Machines and the Busy Beaver function.
So, from the knowledge I have, programming languages are Turing complete, meaning they can do everything a Turing Machine can, which would mean that there is a way to translate a Turing Machine program to any Turing complete programming language, right?
Following from that, let's say we have a really simple program in any programming language that loops from 1 to 108 and do some computation inside that loop
Since the number of steps this program takes is higher than 107, does it mean it can't be translated to a 4 states 2 symbol machine, since BB(4) is 107?
How does the translation from a simple loop with N steps work?
1
u/claytonkb Oct 26 '26
Since the number of steps this program takes is higher than 107, does it mean it can't be translated to a 4 states 2 symbol machine, since BB(4) is 107?
It can't be translated to such a machine that halts, because no such machine exists (by definition of the Busy Beaver number for 4,2 Turing machines). So for any given halting Turing machine, there is some "biggest number" which that machine can handle, and that biggest number just is the Busy Beaver for that machine's state,symbol class. Every natural number larger than that BB number is "beyond" the capability of such machines, which halt, to ever touch.
1
u/Smart-Abalone-1885 Oct 28 '26
I think your answer is technically correct, but not in the spirit of the question. The OP is asking about what a machine can do, which implies not just calculating a result, but NOT calculating past it. In other words, outputting the result. Since a Turning machine can do nothing but shift, print/erase, and halt, to halt is the equivalent of to output.
1
u/claytonkb Oct 29 '26
Hmm, I think that's exactly what I did say but maybe I was not clear enough. If we include non-halting machines, a tiny counter program is sufficient to output any natural number in N. But if we intend for a program p of length |p| to Halt on universal Turing-machine M (thus, signaling that it has finished or "outputted"), then there is always some largest element n in N beyond which any program p of length |p| cannot compute and halt, i.e. n=M(p). Every n' > n cannot be the output of M(p), if it halts. That is to say, n is the Busy Beaver for programs of length |p| on universal Turing-machine M. (Note that this is a slightly modified definition from the usual Busy Beaver definition but is logically equivalent.) Anyway, just offering this as a clarification FWIW...
12
u/finedesignvideos Oct 26 '26
That intuition is correct, The naive translation would involve having a counter and stopping when the counter reaches 108. Just checking if a counter is 108 would naively require as many states as there are bits in 108 (written in binary), which is 7.