The Sieve of Eratosthenes, invented by the Greek mathematician of the same name, provides a quick way
Question:
The Sieve of Eratosthenes, invented by the Greek mathematician of the same name, provides a quick way to nd all prime numbers within a given range. The algorithm involves creating an array of bytes in which positions are marked by inserting 1s in the following manner: Beginning with position 2 (which is a prime number), insert a 1 in each array position that is a multiple of 2. Then do the same thing for multiples of 3, the next prime number. Find the next prime number after 3, which is 5, and mark all positions that are multiples of 5. Proceed in this manner until all multiples of primes have been found. The remaining positions of the array that are unmarked indicate which numbers are prime. For this program, create a 65,000-element array and display all primes between 2 and 65,000.
Write in assembly language
Building Java Programs A Back To Basics Approach
ISBN: 9780135471944
5th Edition
Authors: Stuart Reges, Marty Stepp