The sieve of Sundaram: Difference between revisions

Content added Content deleted
m (→‎{{header|AppleScript}}: Further optimised by only marking two out of every three "numbers" in each sweep. Minor cosmetic changes.)
m (→‎{{header|AppleScript}}: Minor comment edit.)
Line 130: Line 130:
if (i ≥ n2) then exit repeat -- Enough primes obtained.
if (i ≥ n2) then exit repeat -- Enough primes obtained.
set step to step + 2
set step to step + 2
-- The first of /every three/ markings in each sweep (or the third,
-- The first of every three markings in each sweep (or the third,
-- depending on where the count starts) can be omitted, since
-- depending on where the count starts) can be omitted, since
-- it'll be covered by other sweeps or the slot overwritten.
-- it'll be covered by other sweeps or the slot overwritten.