IMath.Lcm

Fore Syntax

Lcm(Values: Array): Double;

Fore.NET Syntax

Lcm(Values: System.Array): double;

Parameters

Values. Array of integer numbers.

Description

The Lcm method returns the least common multiple.

Comments

It is required to use an array of value of the Integer type.

The function works correctly with both one-dimension and two-dimension arrays.

To get the greatest common divisor, use the IMath.Gcd method.

Fore Example

To execute the example, add a link to the MathFin system assembly.

Sub UserProc;
Var r:Double;
    arr:array[5Of Integer;
Begin
    arr[0] := 24;
    arr[1] := 64;
    arr[2] := 32;
    arr[3] := 8;
    arr[4] := 16;
    r:= math.Lcm(arr);
    Debug.WriteLine(r);
End Sub UserProc;

After executing the example the console window displays the least common multiple equal to 192.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example.

Imports Prognoz.Platform.Interop.MathFin;

Public Shared Sub Main(Params: StartParams);
Var
    r: double
;
    Math: MathClass = New MathClass();
    Arr: Array[5Of integer;
Begin
    Arr[0] := 24;
    Arr[1] := 64;
    Arr[2] := 32;
    Arr[3] := 8;
    Arr[4] := 16;
    r := Math.Lcm(Arr);
    System.Diagnostics.Debug.WriteLine(r);

End Sub;

See also:

IMath