1、害死人不偿命的(3n+1)猜想
#include <stdio.h>
int main()
{
int n = 0;
scanf("%d", &n);
int count = 0;
while (n != 1)
{
if (n % 2 == 0)
{
n /= 2;
count++;
}
else
{
n = (3 * n + 1) / 2;
count++;
}
}
printf("%d", count);
return 0;
}
原创
2021-08-07 22:24:55 ·
89 阅读 ·
0 评论