Forgot to add one to pp
in parallel implementation.
This commit is contained in:
parent
f45932e188
commit
80f9cc855d
@ -62,7 +62,7 @@ pub fn is_prime_mem(n:u64, primes:&VecDeque<u64>) -> 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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user