mirror of
https://bitbucket.org/Mattrixwv/projecteulerlua.git
synced 2025-12-06 17:43:57 -05:00
Updated problems to be more in line with conventions
This commit is contained in:
10
Problem6.lua
10
Problem6.lua
@@ -1,11 +1,11 @@
|
||||
--ProjectEuler/lua/Problem6.lua
|
||||
--Matthew Ellison
|
||||
-- Created: 02-06-19
|
||||
--Modified: 03-28-19
|
||||
--Modified: 06-19-20
|
||||
--Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum
|
||||
--All of my requires, unless otherwise listed, can be found at https://bitbucket.org/Mattrixwv/luaClasses
|
||||
--[[
|
||||
Copyright (C) 2019 Matthew Ellison
|
||||
Copyright (C) 2020 Matthew Ellison
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -25,12 +25,12 @@
|
||||
require "Stopwatch"
|
||||
|
||||
|
||||
timer = Stopwatch:create();
|
||||
local timer = Stopwatch:create();
|
||||
timer:start();
|
||||
|
||||
--Create the variables you need
|
||||
sumOfSquares = 0;
|
||||
squareOfSum = 0;
|
||||
local sumOfSquares = 0;
|
||||
local squareOfSum = 0;
|
||||
--Loop through all numbers 1-100 to do the appropriate math with them
|
||||
for num=1,100 do
|
||||
sumOfSquares = sumOfSquares + num^2; --Get the sum of the squares of the first 100 natural number
|
||||
|
||||
Reference in New Issue
Block a user