Math::Prime::TiedArray - Simulate an infinite array of prime numbers
Version 0.04
use Math::Prime::TiedArray; tie my @primes, "Math::Prime::TiedArray";
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, "; }
Pre-calculate all primes smaller than 10,000:
my @primes; tie @primes, "Math::Prime::TiedArray", precompute => 10_000;
Use a persistant cache:
my @primes; tie @primes, "Math::Prime::TiedArray", cache => "/path/to/cache.dbm"
How many new primes should be calculated when the cache runs out.
Set a limit, triggering an exception (croak) if an attempt is made to find a prime larger than the ceiling.
Output debug messages: 0 - none 1 - progress updates for atkin 2 - prime calculations 3 - tie API 4 - internal progress for atkin
Dan Boger, <cpan at peeron.com>
<cpan at peeron.com>
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.
bug-math-prime-tiedarray at rt.cpan.org
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
http://annocpan.org/dist/Math-Prime-TiedArray
CPAN Ratings
http://cpanratings.perl.org/d/Math-Prime-TiedArray
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Math-Prime-TiedArray
Search CPAN
http://search.cpan.org/dist/Math-Prime-TiedArray
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.
To install Math::Prime::TiedArray, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Math::Prime::TiedArray
CPAN shell
perl -MCPAN -e shell install Math::Prime::TiedArray
For more information on module installation, please visit the detailed CPAN module installation guide.