diff --git a/lua/src/p0008.lua b/lua/src/p0008.lua index b7f9f846..d150bdee 100644 --- a/lua/src/p0008.lua +++ b/lua/src/p0008.lua @@ -53,7 +53,7 @@ return { .. "71636269561882670428252483600823257530420752963450") local answer = 0 - for i = 1,(string.len(str)-13),1 + for i = 1,(#str-13),1 do local product = 1 for j = i,(i+12),1 diff --git a/lua/src/p0034.lua b/lua/src/p0034.lua index a6c53812..ef5f2444 100644 --- a/lua/src/p0034.lua +++ b/lua/src/p0034.lua @@ -23,7 +23,7 @@ return { do local xs = tostring(x) local sum = 0 - for i = 1,string.len(xs),1 + for i = 1,#xs,1 do sum = sum + factorial(tonumber(xs:sub(i, i))) end