day1/exercise/collatz.py
author Christopher Burns <chris.d.burns@gmail.com>
Tue, 22 Jun 2010 00:00:54 -0700
branchscipy2010
changeset 421 47427c8d64fe
parent 386 a0bec380b44f
child 425 5afcfce15e71
permissions -rw-r--r--
Added breaks to plan so I could think though the timing when drafting the summary.

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