LCM Function
Returns the Least Common Multiple of two Integers.

Unit
QESBPCSMath

Declaration
Function LCM(const X, Y: LongInt): Int64;

Description
Please note that routine assumes LCM (0, 0) to be invalid and raises an error;

Parameters
First Value to process.
Second Value to process.

Category
Arithmetic Routines for Integers

Implementation

function LCM (const X, Y: LongInt): Int64;
begin
     if (X = 0) or (Y = 0) then
          raise EMathError.Create (rsNotDefinedForValue);
     Result := (x div LongInt (GCD (Abs (X), Abs (Y)))) * Int64 (Y);
End;


HTML generated by Time2HELP
http://www.time2help.com