NAME
Math::Prime::Simple - calculate prime numbers.
SYNOPSIS
use Math::Prime::Simple q/:all/;
@ranges = ( [ 1000, 1100 ],
[ 10000, 11000 ],
);
# primes calculation
$primes = prime (\@ranges);
# primes iteration
while ($prime = each_prime (0, $primes)) {
print "$prime\n";
}
DESCRIPTION
Math::Prime::Simple
calculates prime numbers by applying the modulo operator.
FUNCTIONS
prime
Calculates prime numbers.
@ranges = ( [ 1000, 1100 ],
[ 10000, 11000 ],
);
$primes = prime (\@ranges);
Each range within @ranges will be evaluated and its prime numbers will be saved within the array ref $primes, accessible by the array index e.g the prime numbers of the first range may be accessed by @{$$primes[0]}.
each_prime
Returns each prime number in a scalar context.
while ($prime = each_prime ($item, $primes)) {
print "$prime\n";
}
$item equals the array index of @ranges.
If not all prime numbers are being evaluated by each_prime(), it is recommended to undef @{"Math::Prime::Simple::each_prime_$item"} after usage of each_prime().
EXPORT
prime(), each_prime()
upon request.
TAGS
:all - *()
SEE ALSO
perl(1)
LICENSE
This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.
AUTHOR
Steven Schubiger