From 05b6257e44537f2b4390b588bf5c16aebfc48220 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20A=2E=20Ortega?= Date: Thu, 1 Dec 2016 12:21:09 +0100 Subject: [PATCH] Skip all even numbers since they're all divisible by 2. --- src/Main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Main.cpp b/src/Main.cpp index 116952e..a423803 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -16,7 +16,7 @@ int main(void) { std::vector primes; primes.push_back(2); - unsigned long long num = 2; + unsigned long long num = 3; // Use for to accomodate for OpenMP #pragma omp parallel @@ -26,7 +26,7 @@ int main(void) { #pragma omp critical { myNum = num; - ++num; + num += 2; } bool isPrime = true; #pragma omp barrier