res := RES(x, a, b) := [a, b are polynomials algorithms used: rem(a, b) - remainder after dividing a by b deg(a) - degree of the polynomial a lcof(a) - leading coefficient of the polynomial a, i.e., the coefficient of x^deg(a)] 1. n := deg(a) m := deg(b) 2. if n > m then res :=(-1)^(n m) RES(x, b, a) else lc := lcof(a) if n = 0 then res := lc^m else r := rem(b, a) if r = 0 then res := 0 else p := deg(r) res := lc^(m - p) RES(x, a, r) fi fi fi