Quick fix partition point.

This commit is contained in:
Nicolás A. Ortega Froysa 2022-03-04 16:57:29 +01:00
parent 5c8c7baa75
commit a2dfd6a6ca

View File

@ -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 compound = primes.par_iter().take(pp).any(|x| n % x == 0);
let compound = primes.iter().take(pp).any(|x| n % x == 0);
//let compound = primes.par_iter().take(pp).any(|x| n % *x == 0);
let compound = primes.iter().take(pp+1).any(|x| n % *x == 0);
return !compound;
}