Talk:Sieve of Eratosthenes: Difference between revisions

Content added Content deleted
(→‎Java: the (replacement) Java code shown isn't a Sieve of Eratosthese. -- ~~~~)
Line 94: Line 94:
The problem here is the concept of removing values. Even the "optimisation" of filling nums with odd values is no optimisation at all. Trying to sieve 40004 for the posted algorithm takes around 3.292s ("optimised") while the algorithm above takes 0.006s and the bitset sieve clocks at 0.008s. Thanks
The problem here is the concept of removing values. Even the "optimisation" of filling nums with odd values is no optimisation at all. Trying to sieve 40004 for the posted algorithm takes around 3.292s ("optimised") while the algorithm above takes 0.006s and the bitset sieve clocks at 0.008s. Thanks
--[[User:Xelamitchell|xelamitchell]]
--[[User:Xelamitchell|xelamitchell]]

... Except that the above Java code isn't a ''Sieve of Eratosthenes''.   A ''SoE'' algorithm doesn't '''TEST''' for primality, it ''just'' removes all composites (and sometimes unity);   what's left is a (somehow marked/indicated) list/array of primes [up to the (original) highest element in the list/array of integers]. -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 22:50, 7 October 2013 (UTC)