NAME
Math::Prime::TiedArray - Simulate an infinite array of prime numbers
VERSION
Version 0.04
SYNOPSIS
use Math::Prime::TiedArray;
tie my @primes, "Math::Prime::TiedArray";
DESCRIPTION
Allows access to an array of prime numbers, that will be extended as-needed:
use Math::Prime::TiedArray;
my @primes;
tie @primes, "Math::Prime::TiedArray";
# print the first 100 primes:
print join ", ", @primes[0..99];
# print the 200th prime:
print $primes[199];
# print all the primes smaller than 500
while ((my $prime = shift @primes) < 500) {
print "$prime, ";
}
OPTIONS
precompute => number (default: 1000)
Pre-calculate all primes smaller than 10,000:
my @primes;
tie @primes, "Math::Prime::TiedArray", precompute => 10_000;
cache => path
Use a persistant cache:
my @primes;
tie @primes, "Math::Prime::TiedArray", cache => "/path/to/cache.dbm"
extend_step => number (default: 10)
How many new primes should be calculated when the cache runs out.
extend_ceiling => number
Set a limit, triggering an exception (croak) if an attempt is made to find a prime larger than the ceiling.
debug => level (defualt: 0)
Output debug messages:
0 - none
1 - progress updates for atkin
2 - prime calculations
3 - tie API
4 - internal progress for atkin
AUTHOR
Dan Boger, <cpan at peeron.com>
BUGS
Please report any bugs or feature requests to bug-math-prime-tiedarray at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Math-Prime-TiedArray. 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::Prime::TiedArray
You can also look for information at:
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Math-Prime-TiedArray
Search CPAN
COPYRIGHT & LICENSE
Copyright 2007 Dan Boger, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.