LCM
Syntax |
LCM (x1, x2, *[,xi]*) where xi=0..INTMAX |
Location |
Math Package |
LCM is a function which takes two or more numeric parameters and finds their least common multiple, ie. the smallest number which can be divided by all of the parameters without a remainder. The parameters should be positive integers.
Example
PRINT LCM (2,3,4)
returns 12 and indeed 12/2=6, 12/3=4 and 12/4=3.
NOTE
If you are not looking for the least common multiple but any common multiple then simply multiply all the numbers, eg. 2*3*4=24.
CROSS-REFERENCE