day1/exercise/collatz.py
author Puneeth Chaganti <punchagan@fossee.in>
Wed, 28 Jul 2010 19:50:00 +0530
branchscipy2010
changeset 438 8af5dfa5432b
parent 425 5afcfce15e71
permissions -rw-r--r--
Added FFT stuff to day1/cheatsheet6.

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