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
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
