ScholarMatic | 24/7 Homework Help

ScholarMatic Will Help You Write Your Essays and Term Papers

Answered » You can buy a ready-made answer or pick a professional tutor to order an original one.

Part 1: The Sieve of Eratosthenes:Finding All Prime Numbers up to 1000 Eratosthenes of Cyrene lived approximately 275-195 BC. He was the first to…

by | Nov 28, 2023 | engineering

commentscreenshotsource code.

  • Attachment 1
  • Attachment 2
  • Attachment 3

Part 1: The Sieve of Eratosthenes:Finding All Prime Numbers up to 1000 Eratosthenes of Cyrene lived approximately 275-195 BC. He was the first to accurately estimate the diameter of the earth. For several decades he served as the director and chieflibrarian of the famous library in Alexandria. He was highly regarded in the ancient world, but unfortunately only fragments of his writing have survived. The algorithm described for this assignment is known as the Sieve of Eratosthenes. Please note: You must use this algorithm for this assignment. No other algorithm for ?nding prime numbers will be accepted for this assignment, although there are plenty of other andmore sophisticated algorithms available! Here are some guidelines: o Create a list of 1,000 values all of which are set to zero. a Set the first two values to 1. (This is because zero and one are not prime numbers.) . Now, perform the following process on the element with an index of 2: Read through the entire list starting at 4 (the first multiple of 2), 2 at a time, so that every element that isread contains an index which is a multiple of 2 and store a 1 for that element. This will result in a list in which all of the items whose index is a multiple of 2 will have a value of1. . Now, perform the exact same process for the element with an index of 3, starting your scan on the very next multiple of 3 (the one with an index of 6 in this case). For every itemin the list whose index is a multiple of 3, change the value of that element to 1. If your program finds an element which is already 1, there is nothing further to do for the item. 0 Next, you would expect to perform the exact same process on the item with an index of 4 however, since 4 is already set to 1, there is no need to check its multiples andyour program could just move on to the next item, which has an index of 5. . Here is the pattern as you move from one item in the list to the next: If that item has a value of O, perform the process. If it is already 1, skip the process. It is important that youunderstand why you should skip this process when the element you are considering is already 1. 0 Now, repeat this process over and over. When you have finished, you will find that there are array items which still have a value of O and those items’ index numbers are theprime numbers which you are seeking. – Your program should print out all of the prime numbers which you have found in neatly aligned columns (with up to 10 prime numbers on every row).

ScholarMatic: Explanation & Answer

Your ready answer from a verified tutor is just a click away for as little as $14.99


  

Click Order Now to get 100% Original Answer Customized to your instructions!

HOME TO CERTIFIED WRITERS

Why Place An Order With Us?

  • Certified Editors
  • 24/7 Customer Support
  • Profesional Research
  • Easy to Use System Interface
  • Student Friendly Pricing

Have a similar question?

PLAGIRAISM FREE PAPERS

All papers we provide are well-researched, properly formatted and cited.

TOP QUALITY

All papers we provide are well-researched, properly formatted and cited.

HIGHLY SECURED

All papers we provide are well-researched, properly formatted and cited.

ScholarMatic: Get Started

Assignment Writing Service

Feel safe and secure when placing an order on our portal!
Fruitful cooperation begins with solid guarantees, and we are professional enough to promise perfect results. Let’s get it started!