Skip to content

Commit

Permalink
Slight code compression
Browse files Browse the repository at this point in the history
  • Loading branch information
LivInTheLookingGlass committed Oct 2, 2024
1 parent 0d90ef3 commit 4d09a17
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lua/src/lib/primes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4d09a17

Please sign in to comment.