Math-Prime-XS

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

    root. For example, to assert 211 is prime, divide by 2, 3, 5, 7, 11 and
    13. Since none of these primes divides the number evenly, it is prime.

    Returns all primes for the given number or primes between the base and
    number.

    <http://primes.utm.edu/glossary/page.php?sort=TrialDivision>

BENCHMARK
    Following output resulted from a benchmark measuring the time to
    calculate primes up to 1,000,000 with 100 iterations for each function.
    The tests were conducted by the "cmpthese" function of the Benchmark
    module.

                    Rate   mod_primes trial_primes   sum_primes sieve_primes
     mod_primes   1.32/s           --         -58%         -79%         -97%
     trial_primes 3.13/s         137%           --         -49%         -93%
     sum_primes   6.17/s         366%          97%           --         -86%
     sieve_primes 43.3/s        3173%        1284%         602%           --

    The "Rate" column is the speed in how many times per second, so

lib/Math/Prime/XS.pm  view on Meta::CPAN

example, to assert 211 is prime, divide by 2, 3, 5, 7, 11 and 13. Since
none of these primes divides the number evenly, it is prime.

Returns all primes for the given number or primes between the base and number.

L<http://primes.utm.edu/glossary/page.php?sort=TrialDivision>

=head1 BENCHMARK

Following output resulted from a benchmark measuring the time to calculate
primes up to 1,000,000 with 100 iterations for each function. The tests
were conducted by the C<cmpthese> function of the Benchmark module.

                Rate   mod_primes trial_primes   sum_primes sieve_primes
 mod_primes   1.32/s           --         -58%         -79%         -97%
 trial_primes 3.13/s         137%           --         -49%         -93%
 sum_primes   6.17/s         366%          97%           --         -86%
 sieve_primes 43.3/s        3173%        1284%         602%           --

The "Rate" column is the speed in how many times per second, so
C<sieve_primes()> is the fastest for this particular test.



( run in 1.548 second using v1.01-cache-2.11-cpan-71847e10f99 )