Return to Snippet

Revision: 40555
at February 3, 2011 15:59 by mju4t


Initial Code
% Alexander DeTrano
% Project Euler - Problem 6 
% Find the difference between % the sum of the squares of the first one
% hundred natural numbers and the square of the sum.

first100 = [1:100]; %Generate first 100 numbers
sum_squares = sum(first100.^2); %square each element and sum
squares_sum = sum(first100)^2; %sum each element and square
diff = squares_sum-sum_squares

Initial URL


Initial Description


Initial Title
Project Euler Problem 6

Initial Tags


Initial Language
MatLab