Anonymous user
Talk:Sieve of Eratosthenes: Difference between revisions
→Java
(→Java) |
(→Java) |
||
Line 97:
... 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)
... Hmm, I'm not sure. If by primality check you mean the line "if(isPrime[i])" then it is doing the same work of the posted code's "nums.remove()" (finding the next valid prime to begin marking, it is not a method merely a reference to the array) only much more efficiently. Also my code is
--[[User:Xelamitchell|xelamitchell]] 10:22, 8 October 2013 (UTC)
|