The sum of the squares of the first ten natural numbers is 12 + 22 + 32 + ... + 10 2 = 385.
The square of the sum of the first ten natural numbers is (1 + 2 + 3 + ... + 10)2 = 552 = 3025.
Hence the difference between the square of the sum and the sum of the squares of the first ten natural numbers is 3025 − 385 = 2640.
sumSquareDifference() function that takes argument
n and returns the difference between the square of the sum and the sum of the squares of first
n natural numbers.
For full access to the challenge you need a professional subscription.
A professional subscription will give you full access to all Hexlet courses, the opportunity to seek help from mentors and lifetime access to the theory of lessons learned. You can cancel your subscription at any time.
Last code review
|User||Updated at||Submissions count|
|krivtsov||09 Mar 09:41||1|