Project Euler 29, 43, 48 Python