Implemented optimized solution for problem 1 using a separate method to do the calculation of the sum of the multiples of a number.