fix bug and unpythontic parts in collatz.py