NAME
Math::NumSeq::AlmostPrimes -- semiprimes and other fixed number of prime factors
SYNOPSIS
use Math::NumSeq::AlmostPrimes;
my $seq = Math::NumSeq::AlmostPrimes->new (factor_count => 2);
my ($i, $value) = $seq->next;
DESCRIPTION
The sequence of numbers having a given number of prime factors. The default is the semiprimes factor_count => 2
giving products of two primes P*Q, which is 4,6,9,10,14,15,etc. For example 15 because 15=3*5.
factor_count => $c
controls how many prime factors are to be used. 1 is the primes themselves (the same as Math::NumSeq::Primes). Or for example factor count 4 the sequence is 16,24,36,40,54,60,etc, eg. 60=2*2*3*5.
multiplicity => 'distinct'
asks for products of distinct primes. For the default 2 factors this means no squares like 4=2*2, leaving 6,10,14,15,21,etc. For other factor count it eliminates any repeated factors, so for example factor count 4 becomes 210,330,390,462,510,546,etc. The first in the sequence is the primorial 2*3*5*7=210.
FUNCTIONS
See "FUNCTIONS" in Math::NumSeq for the behaviour common to all path classes.
$seq = Math::NumSeq::AlmostPrimes->new (key=>value,...)
-
Create and return a new sequence object.
$bool = $seq->pred($value)
-
Return true if
$value
is an almost-prime, ie. it has exactlyfactor_count
many prime factors, and ifdistinct
is true then all those factors different..
SEE ALSO
Math::NumSeq, Math::NumSeq::Primes, Math::NumSeq::PrimeFactorCount