Working through Project Euler in Python 3