@@ -0,0 +1,1031 @@
+/*%0A * The Sieve of Eratosthenes is an algorithm used to find prime numbers, up to a given value.%0A * Illustration: https://upload.wikimedia.org/wikipedia/commons/b/b9/Sieve_of_Eratosthenes_animation.gif%0A*/%0Apublic class FindingPrimes%7B%0A%09public static void main(String args%5B%5D)%7B%0A%09%09SOE(20); //Example: Finds all the primes up to 20%0A%09%7D%0A%0A%09public static void SOE(int n)%7B%0A%09%09boolean sieve%5B%5D = new boolean%5Bn%5D;%0A%0A%09%09int check = (int)Math.round(Math.sqrt(n)); //No need to check for multiples past the square root of n%0A%0A%09%09sieve%5B0%5D = false;%0A%09%09sieve%5B1%5D = false;%0A%09%09for(int i = 2; i %3C n; i++)%0A%09%09%09sieve%5Bi%5D = true; //Set every index to true except index 0 and 1%0A%0A%09%09for(int i = 2; i%3C check; i++)%7B%0A%09%09%09if(sieve%5Bi%5D==true)%09%09%09%09%09//If i is a prime%0A%09%09%09%09for(int j = i+i; j %3C n; j+=i)   //Step through the array in increments of i(the multiples of the prime)%0A%09%09%09%09%09sieve%5Bj%5D = false;%09%09%09//Set every multiple of i to false%0A%09%09%7D%0A%09%09for(int i = 0; i%3C n; i++)%7B%0A%09%09%09if(sieve%5Bi%5D==true)%0A%09%09%09%09System.out.print(i+%22 %22); //In this example it will print 2 3 5 7 11 13 17 19%0A%09%09%7D%0A%09%7D%0A%7D%0A

Create FindingPrimes.java