Improved the solution to Problem1

Extracted out calculation of the sum of multiples of n into a separate
function.