From 4d09a1780a5112960b60500d01ccdbf961dd48ab Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 29 Sep 2024 01:14:45 -0500 Subject: [PATCH] Slight code compression --- lua/src/lib/primes.lua | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lua/src/lib/primes.lua b/lua/src/lib/primes.lua index 5b479a3e..4b5b1fc6 100644 --- a/lua/src/lib/primes.lua +++ b/lua/src/lib/primes.lua @@ -9,11 +9,8 @@ local function primes(stop) if steps then for _, step in ipairs(steps) do local value = cand + step - if sieve[value] then - table.insert(sieve[value], step) - else - sieve[value] = { step } - end + sieve[value] = sieve[value] or {} + table.insert(sieve[value], step) end sieve[cand] = nil return next_prime(cand + 1)