1Math::NumSeq::AlmostPriUmseesr(3C)ontributed Perl DocumeMnattaht:i:oNnumSeq::AlmostPrimes(3)
2
3
4

NAME

6       Math::NumSeq::AlmostPrimes -- semiprimes and other fixed number of
7       prime factors
8

SYNOPSIS

10        use Math::NumSeq::AlmostPrimes;
11        my $seq = Math::NumSeq::AlmostPrimes->new (factor_count => 2);
12        my ($i, $value) = $seq->next;
13

DESCRIPTION

15       This sequence is various "almost prime" numbers.  These are numbers
16       with a given number of prime factors.  The default is 2 prime factors,
17       which are the semi-primes.  For example 15 because 15=3*5.
18
19           4, 6, 9, 10, 14, 15, 21, 22, 25, 26, 33, 34, 35, ...
20           # starting i=1
21
22   Factor Count
23       "factor_count => $c" controls how many prime factors are to be used.  1
24       would be the primes themselves (the same as Math::NumSeq::Primes).  Or
25       for example factor count 4 is as follows.  60 is present because
26       60=2*2*3*5 has precisely 4 prime factors.
27
28           # factor_count => 4
29           16, 24, 36, 40, 54, 60, ...
30
31       The first number in the sequence is 2^factor_count, being prime factor
32       2 repeated factor_count many times.
33
34   Multiplicity
35       "multiplicity => 'distinct'" asks for products of distinct primes.  For
36       the default factor count 2 this means exclude squares like 4=2*2, which
37       leaves
38
39           # multiplicity => 'distinct'
40           6, 10, 14, 15, 21, ...
41
42       For other factor counts, multiplicity "distinct" eliminates any numbers
43       with repeated factors, leaving only square-free numbers.  For example
44       factor count 4 becomes
45
46           # factor_count => 4, multiplicity => 'distinct'
47           210, 330, 390, 462, 510, 546, ...
48
49       For multiplicity "distinct" the first value in the sequence is a
50       primorial (see Math::NumSeq::Primorials), being the first
51       "factor_count" many primes multipled together.  For example 210 above
52       is primorial 2*3*5*7.
53

FUNCTIONS

55       See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence
56       classes.
57
58       "$seq = Math::NumSeq::AlmostPrimes->new ()"
59       "$seq = Math::NumSeq::AlmostPrimes->new (factor_count => $integer,
60       multiplicity => $str)"
61           Create and return a new sequence object.  "multiplicity" can be
62
63               "repeated"  repeated primes allowed (the default)
64               "distinct"  all primes must be distinct
65
66       "$bool = $seq->pred($value)"
67           Return true if $value is an almost-prime, ie. it has exactly
68           "factor_count" many prime factors, and if "distinct" is true then
69           all those factors different.
70
71           This check requires factorizing $value and in the current code a
72           hard limit of 2**32 is placed on values to be checked, in the
73           interests of not going into a near-infinite loop.
74

SEE ALSO

76       Math::NumSeq, Math::NumSeq::Primes, Math::NumSeq::PrimeFactorCount
77
78       Math::NumSeq::Primorials
79

HOME PAGE

81       <http://user42.tuxfamily.org/math-numseq/index.html>
82

LICENSE

84       Copyright 2010, 2011, 2012, 2013, 2014 Kevin Ryde
85
86       Math-NumSeq is free software; you can redistribute it and/or modify it
87       under the terms of the GNU General Public License as published by the
88       Free Software Foundation; either version 3, or (at your option) any
89       later version.
90
91       Math-NumSeq is distributed in the hope that it will be useful, but
92       WITHOUT ANY WARRANTY; without even the implied warranty of
93       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
94       General Public License for more details.
95
96       You should have received a copy of the GNU General Public License along
97       with Math-NumSeq.  If not, see <http://www.gnu.org/licenses/>.
98
99
100
101perl v5.28.0                      2014-06-29     Math::NumSeq::AlmostPrimes(3)
Impressum