1Math::NumSeq::Primes(3)User Contributed Perl DocumentatioMnath::NumSeq::Primes(3)
2
3
4

NAME

6       Math::NumSeq::Primes -- prime numbers
7

SYNOPSIS

9        use Math::NumSeq::Primes;
10        my $seq = Math::NumSeq::Primes->new;
11        my ($i, $value) = $seq->next;
12

DESCRIPTION

14       The prime numbers, not divisible by anything except themselves and 1.
15
16           2, 3, 5, 7, 11, 13, 17, 19, ...         (A000040)
17           starting i=1
18
19       Currently this is implemented with "Math::Prime::XS" generating blocks
20       of primes with a sieve of Eratosthenes.  The result is reasonably
21       progressive.  On a 32-bit system there's a hard limit at 2^31 (though
22       even approaching that takes a long time to calculate).
23

FUNCTIONS

25       See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence
26       classes.
27
28       "$seq = Math::NumSeq::Primes->new ()"
29           Create and return a new sequence object.
30
31       "$bool = $seq->pred($value)"
32           Return true if $value is a prime.
33
34           In the current code a hard limit of 2**32 is placed on the $value
35           to be checked, in the interests of not going into a near-infinite
36           loop.
37
38       "$i = $seq->value_to_i_estimate($value)"
39           Return an estimate of the i corresponding to $value.  $value can be
40           any size, it's not limited as in "pred()".  See "Value to i
41           Estimate" below.
42

FORMULAS

44   Value to i Estimate
45       In the current code the number of count of primes up to value is
46       estimated by the well-known asymptotic
47
48           i ~= value/log(value)
49

SEE ALSO

51       Math::NumSeq, Math::NumSeq::TwinPrimes,
52       Math::NumSeq::SophieGermainPrimes, Math::NumSeq::Emirps
53
54       Math::Prime::XS, Math::Prime::TiedArray, Math::Prime::FastSieve,
55       Math::Prime::Util
56

HOME PAGE

58       <http://user42.tuxfamily.org/math-numseq/index.html>
59

LICENSE

61       Copyright 2010, 2011, 2012, 2013, 2014, 2016, 2019, 2020 Kevin Ryde
62
63       Math-NumSeq is free software; you can redistribute it and/or modify it
64       under the terms of the GNU General Public License as published by the
65       Free Software Foundation; either version 3, or (at your option) any
66       later version.
67
68       Math-NumSeq is distributed in the hope that it will be useful, but
69       WITHOUT ANY WARRANTY; without even the implied warranty of
70       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
71       General Public License for more details.
72
73       You should have received a copy of the GNU General Public License along
74       with Math-NumSeq.  If not, see <http://www.gnu.org/licenses/>.
75
76
77
78perl v5.34.0                      2021-07-22           Math::NumSeq::Primes(3)
Impressum