about | help | code help+videos | done | prefs |
sieve
Write a method named sieve that uses the "Sieve of Eratosthenes" algorithm to generate a list of prime numbers between 2 and a given maximum. You will represent the numbers using an array but return an ArrayList of the primes. sieve(2) → [2] sieve(3) → [2, 3] sieve(10) → [2, 3, 5, 7] ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 200 Post-solution available
Copyright Nick Parlante 2017 - privacy