10.21 DivisorsInt

DivisorsInt( n )

DivisorsInt returns a list of all positive divisors of the integer n. The list is sorted, so it starts with 1 and ends with n. We define DivisorsInt( -n ) = DivisorsInt( n ). Since the set of divisors of 0 is infinite calling DivisorsInt( 0 ) causes an error.

DivisorsInt calls FactorsInt (see FactorsInt) to obtain the prime factors. Sigma (see Sigma) computes the sum, Tau (see Tau) the number of positive divisors.

    gap> DivisorsInt( 1 );
    [ 1 ]
    gap> DivisorsInt( 20 );
    [ 1, 2, 4, 5, 10, 20 ]
    gap> DivisorsInt( 541 );
    [ 1, 541 ] 

Previous Up Top Next
Index

GAP 3.4.4
April 1997