Project Euler: Problem 6, Natural numbers, squares and sums. - MATLAB Cody - MATLAB Central

Problem 240. Project Euler: Problem 6, Natural numbers, squares and 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.

Find the difference between the sum of the squares of the first N (where N is the input) natural numbers and the square of the sum.

Thank you to Project Euler Problem 6

Solution Stats

63.77% Correct | 36.23% Incorrect
Last Solution submitted on May 12, 2025

Problem Comments

Solution Comments

Show comments
PIVlab surpasses 100K all-time File Exchange downloads
During the past twelve months, PIVlab, a MATLAB Community Toolbox for particle...
4
8

Problem Recent Solvers2347

Suggested Problems

More from this Author51

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!