以下是代码
def collatz(number):
if number%2==0:
number=number//2
print(str(number))
return number
else:
number=number*3+1
print(str(number))
return number
print('enter your number')
number=int(input())
while number!=1:
collatz(number)
number=collatz(number)
这是结果enter your number516168844221
添加回答
举报
0/150
提交
取消