Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

algorithm Sieve of Eratosthenes is input: an integer nn > 1 . output: all prime numbers from 2 through n . let A be an

algorithm Sieve of Eratosthenes is
input: an integer nn >1.
output: all prime numbers from 2 through n.
let A be an array of Boolean values, indexed by integers 2 to nn,
initially all set to true.
for i =2,3,4,..., not exceeding nn do
if A[i] is true
for j = i2, i2+i, i2+2i, i2+3i,..., not exceeding n do
set A[j] := false
return all i such that A[i] is true.

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_2

Step: 3

blur-text-image_3

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

Visual Basic Net Database Programming

Authors: Rod Stephens

1st Edition

0789726815, 978-0789726810

More Books

Students also viewed these Databases questions

Question

4. Not sure? Ask them.

Answered: 1 week ago

Question

2. How will the team select a leader?

Answered: 1 week ago