Skip to content

Commit a6e629d

Browse files
QS wheel factorization validation
1 parent 43b982e commit a6e629d

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

FindAFactor/_find_a_factor.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,12 +390,12 @@ struct Factorizer {
390390
{
391391
smoothNumberKeys.reserve(rowLimit);
392392
smoothNumberValues.reserve(rowLimit);
393-
for (const size_t p : smoothPrimes) {
394-
smoothWheelRadius *= p;
395-
}
396393
while (smoothPrimes.size() && (smoothPrimes[0U] <= wfl)) {
397394
smoothPrimes.erase(smoothPrimes.begin());
398395
}
396+
for (const size_t p : smoothPrimes) {
397+
smoothWheelRadius *= p;
398+
}
399399
}
400400

401401
BigInteger getNextBatch() {
@@ -443,6 +443,10 @@ struct Factorizer {
443443

444444
// Sieving function
445445
BigInteger sievePolynomials(std::vector<boost::dynamic_bitset<size_t>> *inc_seqs) {
446+
if (smoothWheelRadius < 2U) {
447+
throw std::invalid_argument("Wheel factorization level setting excludes all smooth primes!");
448+
}
449+
446450
for (BigInteger batchNum = getNextBatch(); isIncomplete; batchNum = getNextBatch()) {
447451
// NOTE: If you want to add gear factorization back in, realize that these bounds
448452
// do not yet properly align to exact wheel boundaries, for full repetitions.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ build-backend = "setuptools.build_meta"
88

99
[project]
1010
name = "findafactor"
11-
version = "6.8.1"
11+
version = "6.8.2"
1212
requires-python = ">=3.8"
1313
description = "Find any nontrivial factor of a number"
1414
readme = {file = "README.txt", content-type = "text/markdown"}

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def build_extension(self, ext):
4040

4141
setup(
4242
name='findafactor',
43-
version='6.8.1',
43+
version='6.8.2',
4444
author='Dan Strano',
4545
author_email='stranoj@gmail.com',
4646
description='Find any nontrivial factor of a number',

0 commit comments

Comments
 (0)