summaryrefslogtreecommitdiff
path: root/day1/exercise/collatz.py
blob: e2701379a43ee644aa23a0eb43f0c4273f6eeb7a (plain)
1
2
3
4
5
6
7
8
num = int( raw_input( 'Enter number: ') )
while num != 4:
    print num,
    if num % 2 == 1:
        num = num * 3 + 1
    else:
        num /= 2
print 4, 2, 1