Project Euler in Python: Problems 46–53