mirror of
https://github.com/wiosna-dev/common-library.git
synced 2026-03-13 01:51:50 +01:00
Add Miscellaneous::calculateGreatestCommonDivisor() method
This commit is contained in:
@@ -1319,4 +1319,9 @@ class Miscellaneous
|
||||
|
||||
return substr($string, 1);
|
||||
}
|
||||
|
||||
public static function calculateGreatestCommonDivisor(int $first, int $second): int
|
||||
{
|
||||
return (0 === $second) ? $first : static::calculateGreatestCommonDivisor($second, $first % $second);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user