Extended Euclidean algorithm for two integers
MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.
MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.
igcdex(x, y) computes the nonnegative greatest
g of the integers
t such that g = sx + ty.
igcdex(x, y) returns an expression sequence
s, t with three elements, where
the nonnegative greatest common divisor of
integers such that g = sx + ty.
These data are computed by the extended Euclidean algorithm for integers.
igcdex(0, 0) returns the sequence
1, 0. If
x is non-zero, then
igcdex(x, 0) return
0, sign(x) and
abs(x), sign(x), 0, respectively.
y are non-zero
integers, then the numbers
s,t satisfy the inequalities and .
numlib::igcdmult is an extension of
more than two arguments.
We compute the greatest common divisor of some integers:
The returned numbers satisfy the described equation:
[g, s, t] := [igcdex(9, 15)]; g = s*9 + t*15
If one argument is not a number, the result is the a symbolic
delete x: igcdex(4, x)
arithmetical expressions representing integers
Sequence of three integers, or