Ask Your Question

Revision history [back]

See Wikipedia - Polynomial extended Euclidean algorithm:

A third difference is that, in the polynomial case, the greatest common divisor is defined only up to the multiplication by a non zero constant. There are several ways to define the greatest common divisor unambiguously. In mathematics, it is common to require that the greatest common divisor be a monic polynomial. To get this, it suffices to divide every element of the output by the leading coefficient of $r_k$. This allows that, if a and b are coprime, one gets 1 in the right-hand side of B├ęzout's inequality. Otherwise, one may get any non-zero constant.

So e.g. at the end you can do

lc =
return r0/lc, s0/lc, t0/lc