<?php
class MathHelper
{
public static function getLeastCommonMultiple($a, $b) {
if (bccomp($a, $b) === 0) return $a; list($max, $min) = (bccomp($a, $b) == -1) ?
[$b, $a] : [$a, $b] ;
$lcm = $max;
for ($i = 1; bcmod($lcm, $min) != 0; $i++) { }
return $lcm;
}
}
echo MathHelper::getLeastCommonMultiple('2','100000000000000000000000000000');
PD9waHAKCmNsYXNzIE1hdGhIZWxwZXIKewoJcHVibGljIHN0YXRpYyBmdW5jdGlvbiBnZXRMZWFzdENvbW1vbk11bHRpcGxlKCRhLCAkYikgewoJCWlmIChiY2NvbXAoJGEsICRiKSA9PT0gMCkgcmV0dXJuICRhOwoJCWxpc3QoJG1heCwgJG1pbikgPSAoYmNjb21wKCRhLCAkYikgPT0gLTEpID8gWyRiLCAkYV0gOiBbJGEsICRiXSA7CgoJCSRsY20gPSAkbWF4OwoJCWZvciAoJGkgPSAxOyBiY21vZCgkbGNtLCAkbWluKSAhPSAwOyAkaSsrKSB7IAoJCQkkbGNtID0gYmNtdWwoJG1heCwgJGkpOwoJCX0KCgkJcmV0dXJuICRsY207Cgl9Cn0KCmVjaG8gTWF0aEhlbHBlcjo6Z2V0TGVhc3RDb21tb25NdWx0aXBsZSgnMicsJzEwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMCcpOw==