Hacker News new | ask | show | jobs
by goldenkey 3129 days ago
Just some food for thought. The reason that the busy beaver challenges are enormously difficult to do manually, for higher number of allowed states, is because of two things:

self-modification and fixed points

A turing machine has no understanding of code vs memory. You can scratch out turing machines in their tape form, and simply write a program in C and restrict the memory to a couple of ints and also use labels to write to the code section. This is more practical and still an excercise in how you can use the code as memory once you are certain it is past execution.

But even more clever is having the fixed points of your printing routine be actual equal to NEW instructions written to the code section. Then you begin to truly treat the pc program like a turing machine and push the boundaries of how many operations you can perform before halting.

Now..about fixed points. By fixed point I really just mean a point at which the behavior of a program switches into a different context or ultimately the point at which the program finally halts (necessary for the challenge.)

Lets assume we have byte variables, A and B

We can print 1s quite naively doing this:

A = 0 B = 0

while A++ while B++ print "1";

We would get 256*256 = 65536 prints

But we can extract way more if we use the code section. And we can extract even more if we come up with fixed points / conditions other than just all our variables wrapping back around to 0. Ie. using number theory with each variable as a modulus, we can stop on much rarer conditions.. such as primes that are 1 mod 5, 2 mod 7, 3 mod 11, etc..Essentially, the entire world of coincidental structure and things that appear to be true but may just have very very large outliers..can be exploited to keep on looping. For some examples, take a look here: https://www.quora.com/What-are-some-mathematical-theories-th...

Literally if you can write a function that counts which is greater, li(x) or pi(x), and returns true or false. Then you just do while(liCmpPi(BigNum(allMyMemory).increment()) print(1)

you will have more prints than the universe has atoms. more than the seconds in the universe until heat death. math is fun :-(