ilcm -- the least common multiple
of integers
Introductionilcm(i1, i2...) computes the least common
multiple of the integers i1, i2, ...
Call(s)ilcm(i1, i2...)
Parametersi1, i2... |
- | arithmetical expressions representing integers |
Returnsa nonnegative integer, or a symbolic
ilcm call.
Related
Functionscontent, factor, gcd, gcdex, icontent, ifactor, igcd, igcdex, lcm
Detailsilcm computes the least common nonnegative multiple of
a sequence of integers. ilcm
with a single numeric argument returns its absolute value.
ilcm returns 1 when all arguments are
1 or -1 or no argument is given.ilcm returns an error message when one of the
arguments is a number but not an integer. If
at least one of the arguments is 0, then ilcm
returns 0. Otherwise, if one argument is not a number, then a symbolic ilcm call is
returned.ilcm is a function of the system kernel.
Example
1We compute the least common multiple of some integers:
>> ilcm(-10, 6), ilcm(6, 10, 15)
30, 30
>> a := 4420, 128, 8984, 488: ilcm(a), ilcm(a, 64)
9689064320, 9689064320
The next example shows some special cases:
>> ilcm(), ilcm(0), ilcm(1), ilcm(-1), ilcm(2)
1, 0, 1, 1, 2
If one argument is not a number, then the result is a
symbolic ilcm call, except in some special cases:
>> delete x: ilcm(a, x), ilcm(0, x)
ilcm(4420, 128, 8984, 488, x), 0
>> type(ilcm(a, x))
"ilcm"
0, then ilcm
returns 0.