diff options
Diffstat (limited to 'day1/exercise/collatz.py')
-rw-r--r-- | day1/exercise/collatz.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/day1/exercise/collatz.py b/day1/exercise/collatz.py index 2b980d7..7bed967 100644 --- a/day1/exercise/collatz.py +++ b/day1/exercise/collatz.py @@ -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 |