Sigma( n )
Sigma
returns the sum of the positive divisors (see DivisorsInt) of
the integer n.
Sigma
is a multiplicative arithmetic function, i.e., if n and m are
relatively prime we have sigma(n m) = sigma(n) sigma(m). Together
with the formula sigma(p^e) = (p^{e+1}-1) / (p-1) this allows you to
compute sigma(n).
Integers n for which sigma(n)=2 n are called perfect. Even perfect integers are exactly of the form 2^{n-1}(2^n-1) where 2^n-1 is prime. Primes of the form 2^n-1 are called Mersenne primes, the known ones are obtained for n = 2, 3, 5, 7, 13, 17, 19, 31, 61, 89, 107, 127, 521, 607, 1279, 2203, 2281, 3217, 4253, 4423, 9689, 9941, 11213, 19937, 21701, 23209, 44497, 86243, 110503, 132049, 216091, 756839, and 859433. It is not known whether odd perfect integers exist, however BC89 show that any such integer must have at least 300 decimal digits.
Sigma
usually spends most of its time factoring n (see FactorsInt).
gap> Sigma( 0 ); Error, Sigma: <n> must not be 0 gap> Sigma( 1 ); 1 gap> Sigma( 1009 ); 1010 # thus 1009 is a prime gap> Sigma( 8128 ) = 2*8128; true # thus 8128 is a perfect number
GAP 3.4.4