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!
This commit is contained in:
Chip Hogg
2022-03-19 22:09:51 +00:00
parent 6872117bae
commit b589ba8d86

View File

@@ -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;