by klibertp · 9y ago · 0 comments
What my code snippet is doing is running a sample of a particular chaotic function that was originally inspired by biology (a simple predator/prey model). Ultimately, what happens is that you just cannot predict how the function will behave - it is chaotic.
Ultimately most complex systems start to show some chaotic behaviour, which basically means that the behaviour of the system cannot be predicted in detail, even if virtually everything is known about the system in advance.
One example is if you try saving a simulation to disk you need to copy all internal state or you get a different output.
In "practice", if you could call it such, a computer with limited memory becomes a "linear bounded automaton" and the Halting Problem is decidable; cf. http://cs.stackexchange.com/q/22925
Of course, big enough memory can mean that it can be impossible to detect termination before the heat death of the universe - we are talking theory here.
PS: The halting problem is only undecidable when running with unlimited memory.
x=5
y=5
while True:
if y%2 == 0:
y=y/2
else:
y=3y+1
if y == 1:
x=x+1
y=x
if y==x:
return x
Please predict the code. I'll even give you $500 in memory of some guy named Erdos if you get it right (and I haven't even gone for a provably undecidable example! :) )PS: Don't waste time checking x values less than 1000000000000000000
If your asking the underlying math problem, yes that is true for all positive integers. It's much more obvious in base 3.