aboutsummaryrefslogtreecommitdiff
path: root/challenge-134/abigail/lua
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-134/abigail/lua')
-rw-r--r--challenge-134/abigail/lua/ch-1.lua13
-rw-r--r--challenge-134/abigail/lua/ch-2.lua24
2 files changed, 37 insertions, 0 deletions
diff --git a/challenge-134/abigail/lua/ch-1.lua b/challenge-134/abigail/lua/ch-1.lua
new file mode 100644
index 0000000000..1b0d219dce
--- /dev/null
+++ b/challenge-134/abigail/lua/ch-1.lua
@@ -0,0 +1,13 @@
+#!/opt/local/bin/lua
+
+--
+-- See ../README.md
+--
+
+--
+-- Run as: lua ch-1.lua
+--
+
+for _, tail in ipairs ({789, 798, 879, 897, 978}) do
+ print (1023456000 + tail)
+end
diff --git a/challenge-134/abigail/lua/ch-2.lua b/challenge-134/abigail/lua/ch-2.lua
new file mode 100644
index 0000000000..4ea5926b60
--- /dev/null
+++ b/challenge-134/abigail/lua/ch-2.lua
@@ -0,0 +1,24 @@
+#!/opt/local/bin/lua
+
+--
+-- See ../README.md
+--
+
+--
+-- Run as: lua ch-2.lua < input-file
+--
+
+for line in io . lines () do
+ local _, _, m, n = line : find ("([0-9]+)%s+([0-9]+)")
+ local seen = {}
+ local count = 0
+ for x = 1, m do
+ for y = 1, n do
+ if seen [x * y] == nil then
+ seen [x * y] = 1
+ count = count + 1
+ end
+ end
+ end
+ print (count)
+end