Sieve of Eratosthenes: Difference between revisions
Content deleted Content added
Line 9,717: | Line 9,717: | ||
List<Integer> primes = new ArrayList<Integer>(n); |
List<Integer> primes = new ArrayList<Integer>(n); |
||
boolean[] isComposite = new boolean[n + 1]; |
boolean[] isComposite = new boolean[n + 1]; |
||
for(int i = 2; |
for(int i = 2; i <= n; i++) { |
||
if(!isComposite[i]) { |
if(!isComposite[i]) { |
||
primes.add(i); |
primes.add(i); |