Least Common Multiple

Find the least common multiple (LCM) of two numbers using the GCD-based formula.

Code

Algorithms
function gcd($x, $y) { return $y === 0 ? $x : gcd($y, $x % $y); }
return abs($a * $b) / gcd($a, $b);

Parameters

First number

Second number

Server

More PHP Snippets