Project Euler python solution for 3rd problem