From f45932e1885f90d18ad2a0facf047905921eae22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Ortega=20Froysa?= Date: Wed, 9 Mar 2022 17:15:29 +0100 Subject: [PATCH] Change `compound` to `composite` In English we say "composite" for numbers which are composed as opposed to prime. --- src/test.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/test.rs b/src/test.rs index 3042dba..f178489 100644 --- a/src/test.rs +++ b/src/test.rs @@ -48,9 +48,9 @@ pub fn is_prime_f(n:u64, b:u64) -> bool } let limit = (n as f64).sqrt() as u64 + 1; - let compound = (start..limit).step_by(2).collect::>() + let composite = (start..limit).step_by(2).collect::>() .par_iter().any(|x| n % x == 0); - return !compound; + return !composite; } pub fn is_prime(n:u64) -> bool @@ -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 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; + //let composite = primes.par_iter().take(pp).any(|x| n % *x == 0); + let composite = primes.iter().take(pp+1).any(|x| n % *x == 0); + return !composite; }