Skip to content

Instantly share code, notes, and snippets.

@ga-wolf
Last active March 7, 2016 00:17
Show Gist options
  • Save ga-wolf/60ae6090f70d36db39aa to your computer and use it in GitHub Desktop.
Save ga-wolf/60ae6090f70d36db39aa to your computer and use it in GitHub Desktop.
Sum of Squares and Squares of Sums

Sum of Squares and Squares of Sums

The sum of the squares of the first ten natural numbers is,

1**2 + 2**2 + ... + 10**2 = 385

The square of the sum of the first ten natural numbers is,

(1 + 2 + ... + 10)**2 = 55**2 = 3025

Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 - 385 = 2640.

Make it so that it doesn't just work for the number 10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment