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,7 +1,7 @@
|
||||
--ProjectEuler/lua/Problem14.lua
|
||||
--Matthew Ellison
|
||||
-- Created: 02-07-19
|
||||
--Modified: 03-28-19
|
||||
--Modified: 06-19-20
|
||||
--[[
|
||||
The following iterative sequence is defined for the set of positive integers:
|
||||
n → n/2 (n is even)
|
||||
@@ -10,7 +10,7 @@ Which starting number, under one million, produces the longest chain?
|
||||
]]
|
||||
--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
|
||||
@@ -30,13 +30,13 @@ Which starting number, under one million, produces the longest chain?
|
||||
require "Stopwatch"
|
||||
|
||||
|
||||
timer = Stopwatch:create();
|
||||
local timer = Stopwatch:create();
|
||||
timer:start();
|
||||
|
||||
TOP_NUM = 1000000 --The largest number that you will check against the chain
|
||||
|
||||
--This function returns a table of numbers created by the chain
|
||||
function getChain(startNum)
|
||||
local function getChain(startNum)
|
||||
--Put the starting number in the list
|
||||
local chain = {};
|
||||
chain[#chain+1] = startNum;
|
||||
|
||||
Reference in New Issue
Block a user