NAME

Math::Primality - Advanced Primality Algorithms using GMP

VERSION

Version 0.02

SYNOPSIS

use Math::Primality qw/:all/;

my $t1 = is_pseudoprime($x,$base);
my $t2 = is_strong_pseudoprime($x);

EXPORT

FUNCTIONS

is_pseudoprime($n,$b)

Returns true if $n is a base $b pseudoprime, otherwise false. The variable $n should be a Perl integer or Math::GMPz object.

The default base of 2 is used if no base is given. Base 2 pseudoprimes are often called Fermat pseudoprimes.

if ( is_pseudoprime($n,$b) ) {
    # it's a pseudoprime
} else {
    # not a psuedoprime
}

is_strong_pseudoprime($n,$b)

Returns true if $n is a base $b strong pseudoprime, false otherwise. The variable $n should be a Perl integer or a Math::GMPz object. Strong psuedoprimes are often called Miller-Rabin pseudoprimes.

AUTHOR

Jonathan Leto, <jonathan at leto.net>

BUGS

Please report any bugs or feature requests to bug-math-primality at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Math::Primality. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

THANKS

The algorithms in this module have been ported from the C source code in bpsw1.zip by Thomas R. Nicely, available at http://www.trnicely.net/misc/bpsw.html or in the spec/bpsw directory of the Math::Primality source code. Without his research this module would not be exist.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Math::Primality

You can also look for information at:

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

Copyright 2009 Jonathan Leto, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.