Least common multiple: Difference between revisions

→‎{{header|Standard ML}}: add another SML version
(Add bruijn)
(→‎{{header|Standard ML}}: add another SML version)
 
Line 3,077:
 
=={{header|Standard ML}}==
===Readable version===
<syntaxhighlight lang="sml">fun gcd (0,n) = n
| gcd (m,n) = gcd(n mod m, m)
 
fun lcm (m,n) = abs(x * y) div gcd (m, n)</syntaxhighlight>
 
===Alternate version===
<syntaxhighlight lang="sml">val rec gcd = fn (x, 0) => abs x | p as (_, y) => gcd (y, Int.rem p)
 
23

edits