Method | Description | |
---|---|---|
extendedGCD ( integer $a, integer $b ) : array | Extended greatest common divisor Compute the gcd as a multiple of the inputs: gcd(a, b) = a*a' + b*b' https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm Knuth, The Art of Computer Programming, Volume 2, 4.5.2 Algorithm X. | |
factors ( integer $x ) : array | Get factors of an integer The decomposition of a composite number into a product of smaller integers. | |
gcd ( integer $a, integer $b ) : integer | Greatest common divisor - recursive Euclid's algorithm The largest positive integer that divides the numbers without a remainder. | |
lcm ( integer $a, integer $b ) : integer | Least common multiple The smallest positive integer that is divisible by both a and b. |