1Math::NumSeq::PrimeIndeUxsPerrimCeosn(t3r)ibuted Perl DoMcautmhe:n:tNautmiSoenq::PrimeIndexPrimes(3)
2
3
4

NAME

6       Math::NumSeq::PrimeIndexPrimes -- primes with prime number indexes
7

SYNOPSIS

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

DESCRIPTION

14       This is the sequence of primes which are at prime indexes,
15
16           3, 5, 11, 17, 31, 41, 59, 67, 83, 109, 127, 157, 179, 191, ...
17           starting i=1
18
19       The primes begin
20
21           index  prime
22             1      2
23             2      3     <--+ primes at prime indexes
24             3      5     <--+
25             4      7        |
26             5     11     <--+
27             6     13        |
28             7     17     <--+
29             8     19
30
31       The primes marked "<--" have an index which is prime too.
32
33   Level
34       Optional "level" controls how many repetitions of the prime indexing is
35       to be applied.  The level is based on the order of primeness by Neil
36       Fernandez in the PrimeIndexOrder sequence.
37
38           <http://www.borve.org/primeness/FOP.html>
39
40       The default is level=2, asking for primes with an order of primeness
41       >=2.  level=1 gives all primes, and level=0 gives all integers.
42
43       The next higher level=3 restricts to primes whose index is prime, and
44       then in addition demands that prime is at an index which is prime.
45
46           level => 3
47           5, 11, 31, 59, 127, 179, 277, 331, 431, 599, ...
48
49       Successive levels filter further and the remaining values soon become
50       quite large.  For example level=11 starts at 9737333 (and is quite slow
51       to generate).
52
53   Level Exact
54       Optional "level_type=>'exact'" asks for values which have exactly
55       "level" as their order of primeness.
56
57       With the default level 2 this means primes whose index is a prime, but
58       then the index of that index is not a prime, ie. the iterations of
59       prime index stops there,
60
61           level_type => 'exact', level => 2
62           3, 17, 41, 67, 83, 109, 157, 191, 211, 241, 283, 353, ...
63
64       Here 11 is not in the sequence because its order of primeness is 3,
65       since 11 is at index 5, 5 is at index 3, 3 is at index 2.
66
67       level_type=exact,level=1 means those primes which are at composite
68       indexes.  This is all the primes which are not prime index primes, ie.
69       primes not in the default prime-index-primes sequence.
70
71           level_type => 'exact', level => 1
72           2, 7, 13, 19, 23, 29, 37, 43, 47, 53, 61, 71, 73, 79, ...
73
74       level_type=exact,level=0 means integers which have order of primeness
75       0, which is the composites, ie. the non-primes.
76

FUNCTIONS

78       See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence
79       classes.
80
81       "$seq = Math::NumSeq::PrimeIndexPrimes->new (level => $n)"
82           Create and return a new sequence object.
83
84       "$i = $seq->value_to_i_estimate($value)"
85           Return an estimate of the i corresponding to $value.  $value can be
86           any size.
87

Formulas

89   Value to i Estimate
90       The i for a given value can be estimated by applying the prime-to-i
91       estimate of the plain primes sequence ("Value to i Estimate" in
92       Math::NumSeq::Primes) according to the "level" parameter.
93
94           repeat level many times
95             value = Primes value_to_i_estimate(value)
96
97           if level_type eq "exact"
98             value = value - Primes value_to_i_estimate(value)
99
100           i_estimate = value
101
102       For example the default level=2 prime index primes applies the Primes
103       estimate twice.  A given value is presumed to be a prime, it's index is
104       estimated.  Then that index also has to be a prime (so the original
105       value is a prime index prime), and the index of that is again estimated
106       by the Primes module.
107
108       For "level_type=>'exact'" the final index must be a composite, as
109       opposed to "minimum" where it can be either prime or composite.  That
110       restriction means an extra final Composite value to i, derived from the
111       Primes by simply
112
113           Composite value_to_i_estimate(x)
114             = value - Primes value_to_i_estimate(x)
115

SEE ALSO

117       Math::NumSeq, Math::NumSeq::Primes, Math::NumSeq::PrimeIndexOrder
118

HOME PAGE

120       <http://user42.tuxfamily.org/math-numseq/index.html>
121

LICENSE

123       Copyright 2011, 2012, 2013, 2014, 2016, 2019, 2020 Kevin Ryde
124
125       Math-NumSeq is free software; you can redistribute it and/or modify it
126       under the terms of the GNU General Public License as published by the
127       Free Software Foundation; either version 3, or (at your option) any
128       later version.
129
130       Math-NumSeq is distributed in the hope that it will be useful, but
131       WITHOUT ANY WARRANTY; without even the implied warranty of
132       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
133       General Public License for more details.
134
135       You should have received a copy of the GNU General Public License along
136       with Math-NumSeq.  If not, see <http://www.gnu.org/licenses/>.
137
138
139
140perl v5.34.1                      2022-06-06 Math::NumSeq::PrimeIndexPrimes(3)
Impressum