Skip all even numbers since they're all divisible by 2.
This commit is contained in:
parent
1593e57e90
commit
05b6257e44
@ -16,7 +16,7 @@ int main(void) {
|
|||||||
|
|
||||||
std::vector<unsigned long long> primes;
|
std::vector<unsigned long long> primes;
|
||||||
primes.push_back(2);
|
primes.push_back(2);
|
||||||
unsigned long long num = 2;
|
unsigned long long num = 3;
|
||||||
|
|
||||||
// Use for to accomodate for OpenMP
|
// Use for to accomodate for OpenMP
|
||||||
#pragma omp parallel
|
#pragma omp parallel
|
||||||
@ -26,7 +26,7 @@ int main(void) {
|
|||||||
#pragma omp critical
|
#pragma omp critical
|
||||||
{
|
{
|
||||||
myNum = num;
|
myNum = num;
|
||||||
++num;
|
num += 2;
|
||||||
}
|
}
|
||||||
bool isPrime = true;
|
bool isPrime = true;
|
||||||
#pragma omp barrier
|
#pragma omp barrier
|
||||||
|
Loading…
Reference in New Issue
Block a user