[1] 25164150
Problem 6 - Sum Square Difference
sum of squares
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\).
Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.
https://projecteuler.net/problem=6
Development
This is a straigtforward calculation. It does not require anything complex.
R
Answer 1
Python
Answer 1
Code
x = list(range(1,101))
sum_sq = sum([i**2 for i in x])
sq_sum = sum(x)**2
sq_sum - sum_sq25164150
Reuse
© 2023-2026 Vincent Clemson | This post is licensed under <a href='http://creativecommons.org/licenses/by-nc-sa/4.0/' target='_blank'>CC BY-NC-SA 4.0</a>
Citation
For attribution, please cite this work as:
Clemson, Vincent. 2026. “Problem 6 - Sum Square
Difference.” January 17, 2026. https://prncevince.xyz/euler/problem/0006.html.
