You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
throwstd::runtime_error("No solution produced a congruence of squares. (We found and tried " + std::to_string(result.solutionColumns.size()) + ", but even 1 should maybe be enough.)");
1014
1009
}
1015
1010
1016
-
// Produce a smooth number with its factorization vector.
1017
-
BigInteger makeSmooth(BigInteger num) {
1018
-
BigInteger n = num;
1019
-
while (true) {
1020
-
// Proceed in steps of the GCD with the smooth prime wheel radius.
1021
-
BigInteger factor = gcd(n, diffWheelRadius);
1022
-
if (factor == 1U) {
1023
-
break;
1024
-
}
1025
-
n /= factor;
1026
-
// Remove smooth primes from factor.
1027
-
// (The GCD is necessarily smooth.)
1028
-
for (size_t pi = afterGearPrimeId; pi < smoothPrimes.size(); ++pi) {
1029
-
constsize_t& p = smoothPrimes[pi];
1030
-
if (factor % p) {
1031
-
continue;
1032
-
}
1033
-
factor /= p;
1034
-
if (factor == 1U) {
1035
-
// The step is fully factored.
1036
-
break;
1037
-
}
1038
-
}
1039
-
if (n == 1U) {
1040
-
// The number is fully factored and smooth.
1041
-
break;
1042
-
}
1043
-
}
1044
-
if (n != 1U) {
1045
-
// The number was not fully factored, because it is not smooth.
1046
-
// Make it smooth, by dividing out the remaining non-smooth factors!
1047
-
num /= n;
1048
-
// This probably won't work, for the sieve, but notice that it is
1049
-
// basically no more expensive, at this point, to try this.
0 commit comments