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