Python solution for second Euler challenge