Module:Sandbox/sportzpikachu/lcm

local p = {}

local function range(min, max) local arr = {} local i = min while (i<=max) do		table.insert(arr, i)		i = i + 1 -- not sure how to do i++ in lua end return arr end

local function gcd( m, n ) while n ~= 0 do       local q = m        m = n        n = q % n    end return m end function p.lcm( m, n ) return ( m ~= 0 and n ~= 0 ) and m * n / gcd( m, n ) or 0 end

function p.lcmMultiple(frame) local args = frame:getParent.args; local num = args[1] for key,value in range(args[1], args[2]) do		num = p.lcm(num, value) end return num end

return p