You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Heinrich Bohne (JIRA)" <ji...@apache.org> on 2019/07/23 21:50:00 UTC
[jira] [Created] (NUMBERS-133) Speed up Primes.nextPrime(int)
Heinrich Bohne created NUMBERS-133:
--------------------------------------
Summary: Speed up Primes.nextPrime(int)
Key: NUMBERS-133
URL: https://issues.apache.org/jira/browse/NUMBERS-133
Project: Commons Numbers
Issue Type: Improvement
Components: primes
Affects Versions: 1.0
Reporter: Heinrich Bohne
The method {{Primes.nextPrime(int)}} can use the same algorithm to skip multiples of certain primes as {{SmallPrimes.boundedTrialDivision(int, int, List<Integer>)}} uses, instead of hard-coding the alternating increment of the trial candidate into a loop.
Also, if the argument of the method is smaller than or equal to the 512th prime number, the method can just infer the next higher prime number directly from the array {{SmallPrimes.PRIMES}} without performing any calculations.
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)