gmp_gcdext

PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8
gmp_gcdext - Calculate GCD and multipliers
Manual
Code Examples

gmp_gcdext( GMP|int|string$num1, GMP|int|string$num2 ): array

Calculates g, s, and t, such that a*s + b*t = g = gcd(a,b), where gcd is the greatest common divisor. Returns an array with respective elements g, s and t.

This function can be used to solve linear Diophantine equations in two variables. These are equations that allow only integer solutions and have the form: a*x + b*y = c. For more information, go to the "Diophantine Equation" page at MathWorld

Parameters

num1

A GMP object, an int or a numeric string.

num2

A GMP object, an int or a numeric string.

Return Values

An array of GMP numbers.

Example of gmp_gcdext

Show all examples for gmp_gcdext

PHP Version: