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:
@@ -1,10 +1,10 @@
|
||||
--ProjectEuler/lua/Problem29.lua
|
||||
--ProjectEuler/lua/Problem30.lua
|
||||
-- Created: 10-28-19
|
||||
--Modified: 10-28-19
|
||||
--Modified: 06-19-20
|
||||
--Find the sum of all the numbers that can be written as the sum of the fifth powers of their digits.
|
||||
--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,7 +25,7 @@ require "Stopwatch"
|
||||
|
||||
|
||||
--Returns a table with the individual digits of the number passed to it
|
||||
function getDigits(num)
|
||||
local function getDigits(num)
|
||||
local listOfDigits = {}; --This table holds the individual digits of num
|
||||
--The easiest way to get the individual digits of a number is by converting it to a string
|
||||
local digits = tostring(num);
|
||||
@@ -38,7 +38,7 @@ function getDigits(num)
|
||||
end
|
||||
|
||||
--Gets the sum of a table of numbers
|
||||
function getSumOfTable(ary)
|
||||
local function getSumOfTable(ary)
|
||||
local sum = 0; --Start the sum at 0 so you can add to it
|
||||
--Add every number in the table to the sum
|
||||
for cnt = 1, #ary do
|
||||
|
||||
Reference in New Issue
Block a user