def recursion(n):
if n==1:
return 1
elif n%2==1:
return recursion(3*n+1) + 1
elif n%2==0:
return recursion(n/2) + 1
n = int(input())
result = recursion(n)
print(result)
알고리즘
def recursion(n):
if n==1:
return 1
elif n%2==1:
return recursion(3*n+1) + 1
elif n%2==0:
return recursion(n/2) + 1
n = int(input())
result = recursion(n)
print(result)