where
gcd := GCDPQ(a(x), b(x)) := [a, b are polynomials in Q[x] algorithms used: deg(a) - degree of polynomial a rem(a, b) - remainder after dividing polynomial a by polynomial b] 1. if deg(a) < deg(b) then r := a a := b b := r fi 2. while b != 0 do r := rem(a, b) a := b b := r do 3. return a