You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2019/07/24 21:21:00 UTC

[jira] [Work logged] (NUMBERS-133) Speed up Primes.nextPrime(int)

     [ https://issues.apache.org/jira/browse/NUMBERS-133?focusedWorklogId=282292&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-282292 ]

ASF GitHub Bot logged work on NUMBERS-133:
------------------------------------------

                Author: ASF GitHub Bot
            Created on: 24/Jul/19 21:20
            Start Date: 24/Jul/19 21:20
    Worklog Time Spent: 10m 
      Work Description: Schamschi commented on pull request #68: [NUMBERS-133] Use iteration algorithm from bounded trial division in Primes.nextPrime(int)
URL: https://github.com/apache/commons-numbers/pull/68
 
 
   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.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Issue Time Tracking
-------------------

            Worklog Id:     (was: 282292)
            Time Spent: 10m
    Remaining Estimate: 0h

> 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
>            Priority: Minor
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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)