我该如何检查,如果一个程序终止?我该、程序

2023-09-11 06:21:54 作者:梦醒花落人走茶凉

是否有可用于确定此一般规则?例如:

  INT I = 10;
而(ⅰ→1){
  如果(ⅰ%2 == 0)I = I / 2;
  别的我= 3 * I  -  1;
}
 

解决方案

这是停机问题。不存在一种算法能够做到你的要求的。

Kill Process V1.1.2.10 简体中文绿色免费版 像任务管理器一样终止系统进程工具下载

在具体地,如果有这样的算法,则考拉兹猜想时,在你的问题相关的功能,将是微不足道的(或至少是一个容易得多)。

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).

 
精彩推荐
图片推荐