From 80f9cc855d3fe04d2b81945d682bcd417b975fca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Ortega=20Froysa?= Date: Wed, 9 Mar 2022 17:30:51 +0100 Subject: [PATCH] Forgot to add one to `pp` in parallel implementation. --- src/test.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test.rs b/src/test.rs index f178489..a05116a 100644 --- a/src/test.rs +++ b/src/test.rs @@ -62,7 +62,7 @@ pub fn is_prime_mem(n:u64, primes:&VecDeque) -> bool { let limit = (n as f64).sqrt() as u64; let pp = primes.partition_point(|x| *x < limit); - //let composite = primes.par_iter().take(pp).any(|x| n % *x == 0); + //let composite = primes.par_iter().take(pp+1).any(|x| n % *x == 0); let composite = primes.iter().take(pp+1).any(|x| n % *x == 0); return !composite; }