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