Question: Python Anaconda Code Sieve of Eratosthenes: Since we know that 2 is the only even prime it is wasteful of memory to include info for
Python Anaconda Code
Sieve of Eratosthenes: Since we know that 2 is the only even prime it is wasteful of memory to include info for even numbers. Instead our array should start with the info for 3 and then only keep track of the info for the odd numbers. The program should list the primes less than or equal to an input number, call it n. We may as well assume n is odd.
Note: 2i + 3 runs through the odd numbers in question for i = 0,1,2,3... We can use slot i in our array to store in the info for the odd numbers 2i + 3. WRITE a function that takes i and returns 2i + 3. Write the inverse function also. These functions should enable you to easily find the right places in the array and the corresponding numbers.
Give some sample output of a value n that is pretty big, but the output will fit on one page. What is the biggest value of n you can process in the less than or equal to one minute?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
