Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

.386 ASSEMBLY LANGUAGE: The Sieve of Eratosthenes, invented by the Greek mathematician of the same name, provides a quick way to find all prime numbers

.386 ASSEMBLY LANGUAGE:

The Sieve of Eratosthenes, invented by the Greek mathematician of the same name, provides a quick way to find all prime numbers within a given range. The algorithm involves creating an array of bytes, initialized with zeros, in which positions are marked by inserting 1s in the following manner: Beginning with position 2 (which is a prime number so mark it as 0), 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. Write a program that create a 65,000-element array and mark all non-prime number between 2 and 65,000 by writing 1s in the corresponding bytes.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learning PostgreSQL

Authors: Salahaldin Juba, Achim Vannahme, Andrey Volkov

1st Edition

178398919X, 9781783989195

More Books

Students also viewed these Databases questions

Question

Why is the System Build Process an iterative process?

Answered: 1 week ago