day1/exercise/collatz.py
author Puneeth Chaganti <punchagan@gmail.com>
Thu, 09 Dec 2010 18:38:45 +0530
branchscipyin2010
changeset 440 8839caef9f83
parent 425 5afcfce15e71
permissions -rw-r--r--
Added primes.txt

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