Use phyton TheSieve of Eratosthonesis an algorithm to find all the prime numbers between 1 andsome integerN. It can be implemented with nestedforloops:(a) Make a list of all the integers from 2 throughN.(b) Cross off all the multiples of 2 (except for 2 itself). The smallest number that remains(after 2) is 3.(c) Cross off all the multiples of 3 (except for 3 itself). The smallest number that remainsis 5.(d) Cross off all the multiples of 5 (except for 5 itself). The smallest number that remainsis 7.(e)···(f) Repeat looking for the smallest numberpthat remains and crossing off all of its multiples(except forpitself) until you reach√N.(g) All of the numbers that remain are primeUse the Sieve to print all the prime numbers under 1000.


Are there any questions left?
New questions in the section Engineering
Sign up for the IQClass
Answers from experts with no ads!
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Made with love
This website uses cookies to make IQClass work for you. By using this site, you agree to our cookie policy

Pleased to see you again

IQClass unlocks the learning potential of every child
  • Master useful skills
  • Improve learning outcomes
  • Share your knowledge
Create an account
Sign in
Recover lost password
Or log in with

Create an account

IQClass unlocks the learning potential of every child
  • Master useful skills
  • Improve learning outcomes
  • Share your knowledge
Create an account
Sign Up
Or sign up with
By signing up, you agree to the Terms of use and Privacy policy.
Looking for an answer to a question you need help with?
you have баллов