The exercise instructions currently read;
"Find the difference between the square of the sum and the sum of the squares of the first N natural numbers.
The square of the sum of the first ten natural numbers is (1 + 2 + … + 10)² = 55² = 3025.
The sum of the squares of the first ten natural numbers is 1² + 2² + … + 10² = 385.
Hence the difference between the square of the sum of the first ten natural numbers and the sum of the squares of the first ten natural numbers is 3025 - 385 = 2640
You are not expected to discover an efficient solution to this yourself from first principles; research is allowed, indeed, encouraged. Finding the best algorithm for the problem is a key skill in software engineering…"
I missed the first statement on solving for first N natural numbers and initially assumed that I was solving for the first ten numbers until I ran into the tests and finally understood what I was solving for.
I propose changing the instructions to something a bit like this:
"Find the difference between the square of the sum and the sum of the squares of the first N natural numbers.
Say for example N is 10.
The square of the sum of the first 10 natural numbers is (1 + 2 + … + 10)² = 55² = 3025.
The sum of the squares of the first 10 natural numbers is 1² + 2² + … + 10² = 385.
Hence the difference between the square of the sum of the first 10 natural numbers and the sum of the squares of the first 10 natural numbers is 3025 - 385 = 2640.
Likewise if N is 4.
The square of the sum of the first 4 natural numbers is (1 + 2 + 3 + 4)² = 10² = 100.
The sum of the squares of the first 4 natural numbers is 1² + 2² +3² + 4² = 30.
Hence the difference between the square of the sum of the first 4 natural numbers and the sum of the squares of the first 10 natural numbers is 100 - 30 = 70.
You are not expected to discover an efficient solution to this yourself from first principles; research is allowed, indeed, encouraged. Finding the best algorithm for the problem is a key skill in software engineering…"