1Math::NumSeq::ErdosSelfUrsiedrgeCColnatsrsi(b3u)ted PerlMaDtohc:u:mNeunmtSaetqi:o:nErdosSelfridgeClass(3)
2
3
4
6 Math::NumSeq::ErdosSelfridgeClass -- Erdos-Selfridge classification of
7 primes
8
10 use Math::NumSeq::ErdosSelfridgeClass;
11 my $seq = Math::NumSeq::ErdosSelfridgeClass->new;
12 my ($i, $value) = $seq->next;
13
15 This is a class number for primes by Erdos and Selfridge, or 0 for
16 composites. The default is "class+"
17
18 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 2, 0, 0, 0, 1, 0, 2, 0, 0, ...
19 starting i=1,
20
21 A prime p is classified by factorizing p+1 into primes, then on each of
22 those primes q factorizing q+1, and so on, repeating until reaching
23 entirely 2s and 3s. p=2 or p=3 interchange on factorizing p+1 (2+1=3
24 and 3+1=2*2).
25
26 A prime p where p+1 factorizes to all 2s or 3s is class 1. For example
27 i=11 has 11+1=12=2*2*3 which is all 2s and 3s so class 1. 2 and 3
28 themselves are class 1 too, since their p+1 factorizing gives 2s and
29 3s.
30
31 Further primes are classified by how many iterations of the p+1
32 factorizing is necessary to reach 2s and 3s. For example prime p=3847
33 is iterated as
34
35 3847+1 = 2*13*37
36
37 then 13+1 = 2*7
38 37+1 = 2*19
39
40 then 7+1 = 2*2*2
41 19+1 = 2*2*5
42
43 then 5+1 = 2*3
44
45 So 3847 is class 4 as it took 4 steps to reach all 2s and 3s. Some of
46 the factors become 2s and 3s earlier, but the steps continue until all
47 factors are reduced to 2s and 3s.
48
49 Class -
50 Option "p_or_m => '-'" applies the same procedure to prime factors of
51 p-1, giving a "class-" number.
52
53 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 2, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, ...
54
55 It sometimes happens that class+ is the same as class-, but in general
56 the two are unrelated.
57
58 Primes Only
59 Option "on_values => 'primes'" selects the classes of just the primes,
60
61 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 3, 2, 2, 1, 1, 2, 2, 2, 1, 4, ...
62
64 See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence
65 classes.
66
67 "$seq = Math::NumSeq::ErdosSelfridgeClass->new ()"
68 "$seq = Math::NumSeq::ErdosSelfridgeClass->new (p_or_m => $str,
69 on_values => $str)"
70 Create and return a new sequence object.
71
72 "p_or_m" (a string) can be
73
74 "+" factors of p+1 (the default)
75 "-" factors of p-1
76
77 "on_values" (a string) can be
78
79 "all" classify all integers
80 "primes" classify just the primes
81
82 Random Access
83 "$value = $seq->ith($i)"
84 Return the class number of $value, or 0 if $value is not a prime.
85
86 This method is only available for the default "on_values=>'all'".
87 "$seq->can('ith')" says whether "ith()" can be used (and gives a
88 coderef).
89
90 "$bool = $seq->pred($value)"
91 Return true if $value occurs as a classification, which means any
92 integer "$value >= 0".
93
95 Math::NumSeq, Math::NumSeq::Primes
96
98 <http://user42.tuxfamily.org/math-numseq/index.html>
99
101 Copyright 2012, 2013, 2014, 2016, 2017 Kevin Ryde
102
103 Math-NumSeq is free software; you can redistribute it and/or modify it
104 under the terms of the GNU General Public License as published by the
105 Free Software Foundation; either version 3, or (at your option) any
106 later version.
107
108 Math-NumSeq is distributed in the hope that it will be useful, but
109 WITHOUT ANY WARRANTY; without even the implied warranty of
110 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
111 General Public License for more details.
112
113 You should have received a copy of the GNU General Public License along
114 with Math-NumSeq. If not, see <http://www.gnu.org/licenses/>.
115
116
117
118perl v5.30.0 2019-08-0M5ath::NumSeq::ErdosSelfridgeClass(3)