Refactoring the python part of Project Euler