commons-numbers
commons-numbers copied to clipboard
[NUMBERS-133] Use iteration algorithm from bounded trial division in Primes.nextPrime(int)
I'm not sure if "potentialPrimes" is a good name for the method that generates the iterator, because it doesn't reveal anything about the purpose of the argument (a lower bound). However, "potentialPrimesBeyond" or something similar would be wrong, because the argument itself is also included in the possible range of results. The most descriptive name would be "potentialPrimesGreaterThanOrEqualTo", but this is horribly verbose. "potentialPrimesNotSmallerThan" is only slightly less verbose, and it contains a negation, which is confusing. So I've left it at "potentialPrimes", but any better suggestions are welcome. At least it's a package-private method, so the method name could still be changed any time in the future.
Coverage increased (+0.02%) to 94.276% when pulling c42eb1abf2e351edfead781f7b7436581cee548a on Schamschi:NUMBERS-133 into 08962e853b9843d0ad98e66241fef6cc7d69faeb on apache:master.
How about potentialPrimesGTE? The javadoc can just contain (GTE) in brackets after the greater than or equal to text.
@aherbert That sounds like I good idea. I had also thought about using an abbreviation, but I only considered the one from the LaTeX tag "geq", which would probably have been too LaTeX specific. I don't know how common "gte" is, but chances are it will still prevent more confusion than it causes. Thanks.
@Schamschi The merge of this has been missed. Would you care to rebase this on the current master?