Login     Register

        Contact Us     Search

XLeratorDB/math Documentation

SQL Server Euclidean least common multiple function


ELCM
 
Updated: 17 August 2010
Use ELCM to calculate the least common multiple using Euclid’s method.
Syntax
SELECT [westclintech].[wct].[ELCM] (
   <@Number1, float,>
 ,<@Number2, float,>)
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 Types
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)
----------------------
6552
 
(1 row(s) affected)
 
SELECT wct.ELCM(81, wct.ELCM(63, 729))

 ----------------------

5103

(1 row(s) affected)


Copyright 2008-2024 Westclintech LLC         Privacy Policy        Terms of Service