Refactored Euler 59