If implemented correctly the Sieve is not feasible for large numbers, so I implemented a better way to solve problem 3.