The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Math::Primality - Various Primality Algorithms

VERSION

Version 0.01

SYNOPSIS

    use Math::Primality;
    use Math::BigInt;

    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 Math::BigInt::GMP object or a string if it is larger than long integer, which varies from system to system.

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) ) {
        ...
    } else {
        ...
    }

is_strong_pseudoprime($n,$b)

Returns true if $n is a base $b strong pseudoprime, false otherwise. The variable $n should be a Math::BigInt::GMP object or a string if it is larger than long integer. 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.

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.