Studying divisibility of integers by other integers is a common
task in number theory. The MuPAD^{®} numlib library
contains the functions that support this task. These functions return
all divisors, the sum of all divisors, the number of divisors, and
the number of prime divisors. For example, to find all positive integer
divisors of an integer number, use the `numlib::divisors`

function:

numlib::divisors(12345)

To find only prime divisors of an integer, use the `numlib::primedivisors`

function:

numlib::primedivisors(12345)

To compute the number of all divisors of an integer, use the `numlib::numdivisors`

function.
To compute the number of prime divisors, use the `numlib::numprimedivisors`

function. For
example, the number 123456789987654321 has 192 divisors. Only seven
of these divisors are prime numbers:

numlib::numdivisors(123456789987654321), numlib::numprimedivisors(123456789987654321)

The `numlib::numprimedivisors`

function
does not take into account multiplicities of prime divisors. This
function counts a prime divisor with multiplicity as one prime divisor.
To compute the sum of multiplicities of prime divisors, use the `numlib::Omega`

function.
For example, the number 27648 has 44 divisors, and 2 of them are prime
numbers. The prime divisors of 27648 have multiplicities; the total
sum of these multiplicities is 13:

numlib::numdivisors(27648), numlib::numprimedivisors(27648), numlib::Omega(27648)

You can factor the number 27648 into prime numbers to reveal
the multiplicities. To factor an integer into primes, use the `ifactor`

function:

ifactor(27648)

To compute the sum of all positive integer divisors of an integer
number, use the `numlib::sumdivisors`

function.
For example, compute the sum of positive divisors of the number 12345:

numlib::sumdivisors(12345)

The largest nonnegative integer that divides all the integers
of a sequence exactly (without remainders) is called the greatest
common divisor of a sequence. To compute the greatest common divisor
of a sequence of integers, use the `igcd`

function. For example, compute the
greatest common divisor of the following numbers:

igcd(12345, 23451, 34512, 45123, 51234)

The `icontent`

function
computes the greatest common divisor of the coefficients of a polynomial.
All coefficients must be integers:

icontent(12*x^2 + 16*x + 24)

The smallest integer that is exactly divisible (without remainders)
by all integers of a sequence is called the least common multiple
of a sequence. To compute the least common multiple of a sequence
of integers, use the `ilcm`

function.
For example, compute the least common multiple of the following numbers:

ilcm(12, 5, 2, 21)

Was this topic helpful?