Solution for problem 6.
Refactored to calculate both the square of the sums and the sum of the squares algorithmically as opposed to brute force (as explained in the Project Euler overview for this problem).