summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgcd.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcd.lua b/gcd.lua
index 09a198c..43cfad9 100755
--- a/gcd.lua
+++ b/gcd.lua
@@ -14,8 +14,8 @@ function gcd2(a, b)
end
function gcdn(ns)
- r = ns[1]
- for i = 2, table.maxn(ns) do
+ local r = ns[1]
+ for i = 2, #ns do
r = gcd2(r, ns[i])
end
return r