Euler problem 1, plus some minor adjustments.