From b589ba8d86e90871e4cf0d5f318f0cc44fb8ec80 Mon Sep 17 00:00:00 2001 From: Chip Hogg Date: Sat, 19 Mar 2022 22:09:51 +0000 Subject: [PATCH] Omit redundant computation This stems from an earlier mistake where I was using primes in the first wheel, rather than coprimes-to-the-basis. 1 is not prime, so we used to need to handle it separately (in an implementation which was, to be clear, wrong). It _is_ coprime, so now we get it for free! --- src/core/include/units/bits/prime.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/core/include/units/bits/prime.h b/src/core/include/units/bits/prime.h index 585a3b50..b9e06e72 100644 --- a/src/core/include/units/bits/prime.h +++ b/src/core/include/units/bits/prime.h @@ -149,10 +149,6 @@ struct wheel_factorizer { } for (std::size_t wheel = wheel_size; wheel < n; wheel += wheel_size) { - if (const auto k = first_factor_maybe(n, wheel + 1)) { - return *k; - } - for (const auto& p : coprimes_in_first_wheel) { if (const auto k = first_factor_maybe(n, wheel + p)) { return *k;