Fix for nSievePercentage = 100 in EstimateCandidatePrimeProbability().
parent
abd1c37bc4
commit
d2812fa206
|
@ -1184,7 +1184,7 @@ double EstimateCandidatePrimeProbability(unsigned int nPrimorialMultiplier)
|
|||
// statistically independent after running the sieve, which might not be
|
||||
// true, but nontheless it's a reasonable model of the chances of finding
|
||||
// prime chains.
|
||||
const unsigned int nSieveWeaveOptimalPrime = vPrimes[(unsigned int) ((uint64) nSievePercentage * vPrimes.size() / 100)];
|
||||
const unsigned int nSieveWeaveOptimalPrime = vPrimes[(unsigned int) ((uint64) nSievePercentage * vPrimes.size() / 100) - 1];
|
||||
const unsigned int nAverageCandidateMultiplier = nSieveSize / 2;
|
||||
return (1.781072 * log((double)std::max(1u, nSieveWeaveOptimalPrime)) / (256.0 * log(2.0) + (double) nPrimorialMultiplier + log(nAverageCandidateMultiplier)));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue