Difference of the Square of Sums and the Sum of Squares

A function called on a single natural number.
26 Downloads
Updated 14 Sep 2016

View License

Call this function to evaluate a NATRUAL number x --> dsumsquare(x) This function will produce the difference of the sum of squares of a ll natural numbers 1 to x and the square of the sum of natural numbers 1 to x.
For example:
dsumsquare(3) = (1+2+3)^2-(1^2+2^2+3^2) = 36-14 = 22

Cite As

Andrew Chen (2026). Difference of the Square of Sums and the Sum of Squares (https://www.mathworks.com/matlabcentral/fileexchange/59140-difference-of-the-square-of-sums-and-the-sum-of-squares), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2016a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Version Published Release Notes
1.0.0.0