From 0a67a970b1d773061c81d357b48135951849e16c Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Mon, 9 Sep 2024 23:20:44 -0500 Subject: [PATCH] string.len() -> # --- lua/src/p0008.lua | 2 +- lua/src/p0034.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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