How do I check if a program terminates?
问题 Is there a general rule that can be used to determine this? E.g: int i = 10; while (i > 1 ) { if (i%2 == 0) i = i/2; else i = 3*i - 1; } 回答1: This is the halting problem. There does not exist an algorithm capable of doing what you ask. In particular, if there was such an algorithm, then the collatz conjecture, related to the function in your question, would be trivial (or at least a lot easier). 回答2: You may be referring to the stopping problem. In short, there is no general way to determine