是否有可用于确定此一般规则?例如:
INT I = 10;
而(ⅰ→1){
如果(ⅰ%2 == 0)I = I / 2;
别的我= 3 * I - 1;
}
解决方案
这是停机问题。不存在一种算法能够做到你的要求的。
在具体地,如果有这样的算法,则考拉兹猜想时,在你的问题相关的功能,将是微不足道的(或至少是一个容易得多)。
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;
}
解决方案
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).
上一篇:等级序树遍历遍历、等级
下一篇:如何降低范围名单?范围、名单