Euler solution problem #18