Logo

ELCM

Updated 2023-10-13 20:09:40.810000

Syntax

SELECT [westclintech].[wct].[ELCM] (
  <@Number1, float,>
 ,<@Number2, float,>)

Description

Use the scalar function ELCM to calculate the least common multiple using Euclid’s method.

Arguments

@Number1

the first number used in the calculation. @Number1 is an expression of type float or of a type that can be implicitly converted to float.

@Number2

the first number used in the calculation. @Number2 is an expression of type float or of a type that can be implicitly converted to float.

Return Type

float

Remarks

ELCM calculates the least common multiple for two numbers. To calculate the least common mulitple for more than two numbers it might be easier to use the aggregate function LCM.

Since the least common multiple is associative, it is entirely acceptable for either @Number1 or @Number2 to be the result of ELCM

Examples

SELECT wct.ELCM(63, 728);

This produces the following result.

{"columns":[{"field":"column 1","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"column 1":"6552"}]}
SELECT wct.ELCM(81, wct.ELCM(63, 729));

This produces the following result.

{"columns":[{"field":"column 1","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"column 1":""},{"column 1":"5103"}]}