blob: 3c39a4b8f29461e7f785c6ee066577b1f4b54c2b (
plain) (
tree)
|
|
local function sum_of_squares(n)
local total = 0
for i = 1, n do
total = total + i^2
end
return total
end
local function square_of_sum(n)
return n^2*(n+1)^2/4
end
print(square_of_sum(100) - sum_of_squares(100))
|