Question
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
using namespace std;
int main() {
unsigned int amount = 0;
cin >> amount;
vector
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started