Module:Primes in edo fs: Difference between revisions
make fs parameter accept defined switches: 1 as number and 1 as string |
force sign for non-zero fifthspans |
||
| Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
-- https://rosettacode.org/wiki/Greatest_common_divisor#Lua | -- greatest common divisor of a and b | ||
-- source: https://rosettacode.org/wiki/Greatest_common_divisor#Lua | |||
local function gcd(a, b) | local function gcd(a, b) | ||
while b ~= 0 do | while b ~= 0 do | ||
| Line 86: | Line 87: | ||
rsp = rsp - edo | rsp = rsp - edo | ||
end | end | ||
if rsp ~= 0 then | |||
if rsp | rsp = string.format('%+.0f', rsp) | ||
end | end | ||
table.insert(fspans, ' '.. fmt_sign(rsp)) | table.insert(fspans, ' '.. fmt_sign(rsp)) | ||