Logo

Programming-Idioms

History of Idiom 75 > diff from v26 to v27

Edit summary for version 27 by SpartakusMd:
New PHP implementation by user [SpartakusMd]

Version 26

2019-09-27, 10:45:45

Version 27

2019-09-27, 12:06:36

Idiom #75 Compute LCM

Compute the least common multiple x of big integers a and b. Use an integer type able to handle huge numbers.

Idiom #75 Compute LCM

Compute the least common multiple x of big integers a and b. Use an integer type able to handle huge numbers.

Imports
extension=gmp
Code
$gcd = gmp_lcm($a, $b);
echo gmp_strval($gcd);
Doc URL
https://www.php.net/manual/ro/function.gmp-lcm.php
Demo URL
https://3v4l.org/sLrvf