day1/exercise/collatz.py
author Santosh G. Vattam <vattam.santosh@gmail.com>
Mon, 22 Feb 2010 14:32:01 +0530
changeset 373 f04eca8b2f3d
parent 354 5dc6c3673f9d
child 386 a0bec380b44f
permissions -rw-r--r--
Commits from NIT DGP and IITK

a = int( raw_input( 'Enter number: ') )
while a != 4:
    print a
    if a % 2 == 1:
        a = a * 3 + 1
    else:
        a /= 2
print 4
print 2
print 1