changeset 354 | 5dc6c3673f9d |
parent 64 | 333092b68926 |
child 386 | a0bec380b44f |
--- a/day1/exercise/collatz.py Sun Jan 10 23:09:00 2010 +0530 +++ b/day1/exercise/collatz.py Tue Jan 12 19:03:34 2010 +0530 @@ -1,7 +1,10 @@ -a = -1 -while a > 1: +a = int( raw_input( 'Enter number: ') ) +while a != 4: print a - if a % 2: + if a % 2 == 1: a = a * 3 + 1 else: a /= 2 +print 4 +print 2 +print 1