← Back to List

14920번: 3n+1 수열 ↗

Solutions

Python 3
105 B | 105 chars
c=int(input())
n=0
while c!=1:
    if c%2 ==0:
        c/=2
    else:
        c=3*c+1
    n+=1
print(n+1)