day1/exercise/collatz.py
author Puneeth Chaganti <punchagan@fossee.in>
Thu, 09 Dec 2010 22:37:22 +0530
branchscipyin2010
changeset 445 956b486ffe6f
parent 425 5afcfce15e71
permissions -rw-r--r--
Renamed day1/session6 to day1/session4.

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