Python practice for Project Euler: Solving mathematic problems with program