1Math::NumSeq::Abundant(U3s)er Contributed Perl DocumentatMiaotnh::NumSeq::Abundant(3)
2
3
4

NAME

6       Math::NumSeq::Abundant -- abundant numbers, greater than sum of
7       divisors
8

SYNOPSIS

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

DESCRIPTION

15       The abundant numbers, being integers greater than the sum of their
16       divisors,
17
18           12, 18, 20, 24, 30, 36, ...
19           starting i=1
20
21       For example 12 is abundant because its divisors 1,2,3,4,6 add up to 16
22       which is > 12.
23
24       This is often expressed as 2*n>sigma(n) where sigma(n) is the sum of
25       divisors of n including n itself.
26
27   Deficient
28       Option "abundant_type => "deficient"" is those integers n with n < sum
29       divisors,
30
31           abundant_type => "deficient"
32           1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 13,
33
34       This is the opposite of abundant, except the few perfect numbers n ==
35       sum divisors are excluded (see "Perfect Numbers" below).
36
37   Primitive Abundant
38       Option "abundant_type => "primitive"" gives abundant numbers which are
39       not a multiple of some smaller abundant,
40
41           abundant_type => "primitive"
42           12, 18, 20, 30, 42, 56, 66, 70, 78, ...
43
44       If an integer n is abundant then so are all multiples 2*n, 3*n, 4*n,
45       etc.  The "primitive" abundants are those which are not such a
46       multiple.
47
48       Option "abundant_type => "non-primitive"" gives abundant numbers which
49       are not primitive, ie. which have a divisor which is also abundant.
50
51           abundant_type => "non-primitive"
52           24, 36, 40, 48, 54, 60, 72, 80, 84, ...
53
54       The abundant are all either primitive or non-primitive.
55
56   Perfect Numbers
57       Numbers with n == sum divisors are the perfect numbers 6, 28, 496,
58       8128, 33550336, etc.  There's nothing here for them currently.  They're
59       quite sparse, with Euler proving the even ones are always
60       n=2^(k-1)*(2^k-1) for prime 2^k-1 (those being the Mersenne primes).
61       The existence of any odd perfect numbers is a famous unsolved problem.
62       If there are any odd perfect numbers then they're very big.
63

FUNCTIONS

65       See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence
66       classes.
67
68       "$seq = Math::NumSeq::Abundant->new ()"
69       "$seq = Math::NumSeq::Abundant->new (abundant_type => $str)"
70           Create and return a new sequence object.  "abundant_type" (a
71           string) can be
72
73              "abundant"        n > sum divisors (the default)
74              "deficient"       n < sum divisors
75              "primitive"       abundant and not a multiple of an abundant
76              "non-primitive"   abundant and also a multiple of an abundant
77
78       "$bool = $seq->pred($value)"
79           Return true if $value is abundant, deficient or primitive abundant
80           per $seq.
81
82           This check requires factorizing $value and in the current code a
83           hard limit of 2**32 is placed on values to be checked, in the
84           interests of not going into a near-infinite loop.
85

FORMULAS

87   Predicate
88       For prime factorization n=p^a * q^b * ... the divisors are all of
89
90           divisor = p^A * q^B * ...   for A=0 to a, B=0 to b, etc
91
92       This includes n itself with A=a,B=b,etc.  The sum is formed by grouping
93       each with factor p^i, etc, resulting in a product,
94
95           sigma =   (1 + p + p^2 + ... + p^a)
96                   * (1 + q + q^2 + ... + q^a)
97                   * ...
98
99           sigma = (p^(a+1)-1)/(p-1) * (q^(b+1)-1)/(q-1) * ...
100
101       So from the prime factorization of n the sigma is formed and compared
102       against n,
103
104           sigma > 2*n      abundant
105           sigma < 2*n      deficient
106
107   Predicate -- Primitive
108       For primitive abundant we want to know also that no divisor of n is
109       abundant.
110
111       For divisors of n it suffices to consider n reduced by a single prime,
112       so n/p.  If taking out some non-prime such as n/(p*q) gives an abundant
113       then so is n/p because it's a multiple of n/(p*q).  To testing an n/p
114       for abundance,
115
116           sigma(n/p) > 2*n/p     means have an abundant divisor
117
118       sigma(n/p) can be calculated from sigma(n) by dividing out the p^a term
119       described above and replacing it with the term for p^(a-1).
120
121           oldterm = (p^(a+1) - 1)/(p-1)
122           newterm = (p^a     - 1)/(p-1)
123
124           sigma(n) * newterm / oldterm > n/p
125           sigma(n) * p*newterm / oldterm > n
126
127       p*newterm/oldterm simplifies to
128
129           sigma(n) * (1 - 1/oldterm) > n      means an abundant divisor
130
131       The left side is a maximum when the factor (1 - 1/oldterm) reduces
132       sigma(n) by the least, and that's when oldterm is the biggest.  So to
133       test for primitive abundance note the largest term in the sigma(n)
134       calculation above.
135
136           if sigma(n) > 2*n
137           then n is abundant
138
139           if sigma(n) * (1-1/maxterm) > 2*n
140           then have an abundant divisor and so n is not primitive abundant
141

SEE ALSO

143       Math::NumSeq
144

HOME PAGE

146       <http://user42.tuxfamily.org/math-numseq/index.html>
147

LICENSE

149       Copyright 2010, 2011, 2012, 2013, 2014, 2016, 2019, 2020 Kevin Ryde
150
151       Math-NumSeq is free software; you can redistribute it and/or modify it
152       under the terms of the GNU General Public License as published by the
153       Free Software Foundation; either version 3, or (at your option) any
154       later version.
155
156       Math-NumSeq is distributed in the hope that it will be useful, but
157       WITHOUT ANY WARRANTY; without even the implied warranty of
158       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
159       General Public License for more details.
160
161       You should have received a copy of the GNU General Public License along
162       with Math-NumSeq.  If not, see <http://www.gnu.org/licenses/>.
163
164
165
166perl v5.36.0                      2022-07-22         Math::NumSeq::Abundant(3)
Impressum