Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Program to Implement Sieve of Eratosthenes: for largest number #include #include using namespace std; int main() { unsigned int amount = 0; cin >>

C++ Program to Implement Sieve of Eratosthenes: for largest number

#include #include

using namespace std;

int main() {

unsigned int amount = 0;

cin >> amount;

vectornumbers;

for (unsigned int i = 0; i <= amount; i++) { numbers.push_back(i);

}

for (unsigned int p = 2; p < amount; p++) { if (numbers[p] == 0)

continue;

cout << p << ' ';

for (unsigned int i = p + p; i <= amount; i += p) { numbers[i] = false;

} }

return 0; }

this code for large prime number ... how can i use this code by thearding

ask user number of theard then prime number in openmpi

for example 100000000 the value 2 for the number of threads

please help me

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

More Books

Students also viewed these Databases questions