Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C PROGRAM 6.7. Prime numbers can also be generated by an algorithm known as the Sieve of Erastosthenes The algorithm for this procedure is presented

image text in transcribed C PROGRAM
6.7. Prime numbers can also be generated by an algorithm known as the Sieve of Erastosthenes The algorithm for this procedure is presented here. Write a program that implements this algorithm. Have the program find all prime numbers up to n = 150, what can you say about this algorithm as compared to the ones used in the text for calculating prime numbers? Sieve of Erastosthenes Algorithm To Display All Prime Numbers Between 1 and n Step 1: Define an array of integers P. Set all elements P, to 0,2 n, the algorithm terminates. Step 4: If P, is 0,then i is prime Step 5: For all positive integer values of j, such that i x jn, set Pay to Step 6: Add 1 to i and go to step 3

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

More Books

Students also viewed these Databases questions

Question

2. Grade oral reports and class participation.

Answered: 1 week ago

Question

Using Language That Works

Answered: 1 week ago

Question

4. Are my sources relevant?

Answered: 1 week ago