/
View dependency graph
Depends on
- gmp (libgmp-dev)
- libdevel-checklib-perl (libdevel-checklib-perl)
- libmath-prime-util-perl (libmath-prime-util-perl)
- perl (perl, perl-xs-dev)
- debhelper-compat
Used by
README (full)
Math::Prime::Util::GMP version 0.53
A module for number theory in Perl using GMP. This includes primality tests,
getting primes in a range, factoring, and more.
These use GMP directly, so should be quite fast for bignums. This module is
mainly intended to be used within Math::Prime::Util, but most functions can
be easily used in independent C programs. Some, like factoring and primality
proving, have explicit ways of compiling as standalone programs.
SYNOPSIS
use feature say;
use bigint;
use Math::Prime::Util::GMP qw/is_prime/;
# Max size of a number is 250 assigned to a scalar as a number
# is_prime accepts a bigint as a string
my $bignum = "27188762623694447842124996538064039444034480940561898523069471141322552613142248049662205275973369340310432664971214620312500867999795559094898390220747143052478910604268911012707898393728029267456459638286456542290811906119936040794792836567800517712998324001798156031927248728220625109007338679765933511619979774789836912923556217410691909195918721300495567162524824116421834972571058278049256235507898646245768556946276949788343519575161621940362646866507884693948582445313246609982609803440514973664475699712739781845803535392293307648102481184237357244142946254918813030632212409545324607906367812717102049454943";
say "$bignum is ", is_prime($bignum) ? "prime" : "not prime";
See the POD module documentation for examples and more information on all the
methods included.
INSTALLATION
To install this module type the following:
perl Makefile.PL
make
make test
make install
You will need a C compiler compatible with the compiler used to build Perl,
and the GMP development system installed. If you can install or have installed
Math::BigInt::GMP or Math::GMPz then this module should have no issues.
Fedora: sudo yum install gmp gmp-devel
Ubuntu: sudo apt-get install libgmp3 libgmp3-dev
Cygwin: install gmp, libgmp-devel, libgmp3
If you would like to make a standalone executable for ECPP, the easiest method
is to run the xt/create-standalone.sh script, which will create a standalone/
directory with Makefile and README. You should make sure you have the large
discrimiment set (https://github.com/danaj/Math-Prime-Util-GMP/tree/master/xt/).
You may also simply compile it with:
gcc -O3 -fomit-frame-pointer -DSTANDALONE -DSTANDALONE_ECPP ecpp.c bls75.c \
ecm.c simpqs.c prime_iterator.c gmp_main.c small_factor.c utility.c \
-lgmp -lm -o ecpp-dj
DEPENDENCIES
Perl 5.6.2 or later. No modules outside of Core have been used.
COPYRIGHT AND LICENCE
Copyright (C) 2011-2025 by Dana Jacobsen <[email protected]>
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
| dir | debian/ |
| dir | examples/ |
| dir | inc/ |
| dir | lib/ |
| dir | t/ |
| dir | xt/ |
| file | .travis.yml |
| file | Changes |
| file | LICENSE |
| file | MANIFEST |
| file | META.json |
| file | META.yml |
| file | Makefile.PL |
| file | README |
| file | TODO |
| file | XS.xs |
| file | aks.c |
| file | aks.h |
| file | bls75.c |
| file | bls75.h |
| file | class_poly_data.h |
| file | ecm.c |
| file | ecm.h |
| file | ecpp.c |
| file | ecpp.h |
| file | factor.c |
| file | factor.h |
| file | gmp_main.c |
| file | gmp_main.h |
| file | isaac.c |
| file | isaac.h |
| file | lucas_seq.c |
| file | lucas_seq.h |
| file | misc_ui.c |
| file | misc_ui.h |
| file | pbrent63.c |
| file | pbrent63.h |
| file | perfect_powers.c |
| file | perfect_powers.h |
| file | poly.c |
| file | poly.h |
| file | powerfree.c |
| file | powerfree.h |
| file | primality.c |
| file | primality.h |
| file | prime_iterator.c |
| file | prime_iterator.h |
| file | ptypes.h |
| file | random_prime.c |
| file | random_prime.h |
| file | real.c |
| file | real.h |
| file | rootmod.c |
| file | rootmod.h |
| file | simpqs.c |
| file | simpqs.h |
| file | squfof126.c |
| file | squfof126.h |
| file | tinyqs.c |
| file | tinyqs.h |
| file | utility.c |
| file | utility.h |