From 2495a82d9b9d29f4cfd128015fe1fca306622494 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 9 Sep 2024 00:04:39 -0500 Subject: [PATCH] typos --- lua/src/p0004.lua | 2 +- lua/src/p0034.lua | 3 +-- lua/src/p0076.lua | 5 ++--- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lua/src/p0004.lua b/lua/src/p0004.lua index 3dc977a9..41939b15 100644 --- a/lua/src/p0004.lua +++ b/lua/src/p0004.lua @@ -18,7 +18,7 @@ return { local p = u * v local ps = tostring(p) - if ps == ps.reverse() and p > answer + if ps == string.reverse(ps) and p > answer then answer = p end diff --git a/lua/src/p0034.lua b/lua/src/p0034.lua index f36d4f2e..c026d127 100644 --- a/lua/src/p0034.lua +++ b/lua/src/p0034.lua @@ -23,8 +23,7 @@ return { do local xs = tostring(x) local sum = 0 - - for i = 1,xs.len(),1 + for i = 1,len(xs),1 do sum = sum + factorial(tonumber(xs[i])) end diff --git a/lua/src/p0076.lua b/lua/src/p0076.lua index e5054788..333097c7 100644 --- a/lua/src/p0076.lua +++ b/lua/src/p0076.lua @@ -36,10 +36,9 @@ return { idx = 2 repeat + counts[idx + 1] = 0 -- please remember lua is 1-indexed idx = idx + 1 - counts[idx] = 0 -- please remember lua is 1-indexed - idx = idx + 1 - counts[idx] = counts[idx] + idx - 1 + counts[idx + 1] = counts[idx + 1] + idx for i = (idx - 1),101,1 do