Implement the sieve of eratosthenes and use it to find all


Need help with this JAVA project. Can NOT use multiples, division. Only addition and subtraction . Do not use builtin isprime, but find the primes by figuring out 2,3,5 multiples(even though can not use multiples, but can think this way: move every other space from 2 will not be a prime, move every 5 space from 5 is not a prime)

I need to output all the primes for step sieve, do not output the amount of primes. And please remember, there are 2 parts, sieve and goldbach.

Below are the description:

The Sieve of Eratosthenes and Goldbach's Conjecture

Implement the Sieve of Eratosthenes and use it to find all prime numbers less than or equal to one million. Use the result to prove Goldbach's Conjecture for all even integers between four and one million, inclusive.

Implement a method with the following declaration:
public static void sieve(int[] array);
This function takes an integer array as its argument. The array should be initialized to the values 1 through 1000000. The function modifies the array so that only the prime numbers remain; all other values are zeroed out.
This function must be written to accept an integer array of any size. You must output for all prime numbers between 1 and 1000000, but when I test your function it may be on an array of a different size.
Implement a method with the following declaration:
public static void goldbach(int[] array);
This function takes the same argument as the previous method and displays each even integer between 4 and 1000000 with two prime numbers that add to it.
The goal here is to provide an efficient implementation. This means no multiplication, division, or modulus when determining if a number is prime. It also means that the second method must find two primes efficiently.
Outputs for your program: All prime numbers between 1 and 1000000 and all even numbers between 4 and 1000000 and the two prime numbers that sum up to it. Use command line arguments!

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Implement the sieve of eratosthenes and use it to find all
Reference No:- TGS02393349

Now Priced at $10 (50% Discount)

Recommended (97%)

Rated (4.9/5)