Algorithm: Euler problem 1 refined.