GithubHelp home page GithubHelp logo

math--primality's People

Contributors

bubaflub avatar danaj avatar leto avatar shlomif avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

math--primality's Issues

Document running time of current AKS implementation

There are various optimizations for the AKS algorithm but if I recall correctly, the "naive" AKS algorihm is O(n^12). @bubaflub, can you add some info to the Math::Primality::AKS pod about the approximate running time of the current implementation?

is_strong_pseudoprime incorrect for bases > n

is_strong_pseudoprime(367, 1101) returns 0 (1101 = 367*3)

The function needs to either indicate using bases >= n are invalid, or do something like (pseudocode):

if (base >= n)
base %= n
if (base <= 1 || base == n-1)
return 1

The first protects us from mistakes such as indicating primes are composites when the base is a multiple of n. The latter opens up better deterministic tests since it won't return wrong answers.

I'll put a patch on my todo list unless someone gets to it first.

Implement ECPP

I just released a version of Math::Prime::Util::GMP with ECPP (Elliptic Curve Primality Proving). With a small set of fixed determinants, it's good for proving 700-bit (216 digit) primes in ~1 second, including a certificate. Adding this to Math::Primality would be nice.

There are a number of improvements that could be made to my implementation to support larger sizes -- at 400 digits or so it occasionally gets bogged down in factoring due to a FPS strategy (basically go depth first and don't backtrack even if we get stuck trying to crack factors off huge numbers that won't cooperate). Adding simple backtracking would help, but once we get much over 500 digits that starts breaking down also (if we get stuck at the top level there's nowhere to backtrack to). I can add more fixed discriminants which delays the issue at the expense of memory.

The algorithm itself is relatively straightforward, but it needs a lot of support polynomial functions as well as some basic factoring (a good Pollard n-1 works wonders, and a good ECM is recommended also). Some of these have CPAN modules that may or may not work (e.g. polynomial root finding), and a lot of the rest should be in Math::Polynomial (i.e. it's already there or should be added if not).

In the long run, making your own Hilbert and Weber polynomials using Math::MPFR would be a big win, especially if you have fast root finding.

Research feasibility of using Math::Polynomial+Math::GMPz instead of Math::Primality::BigPolynomial

Currently we have Math::Primality::BigPolynomial, which basically allows you to create univariate polynomials with Math::GMPz objects as coefficients.

Last night I was going to extract BigPolynomial out to it's own CPAN module, but I ran across Math::Polynomial, which allows arbitrary objects as coefficients of univariate polynomials.

It seems like we could remove the need for M::P::BigPolynomial if we have Math::Primality::AKS use Math::Polynomial with Math::GMPz objects. This would also mean moving the mpz_* functions out of M::P::BigPolynomial back into M::P::AKS, which is probably where they belong, for now.

Any comments about this, @bubaflub ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.