### 5.28.7 GCD of two polynomials with the Euclidean algorithm: gcd

gcd denotes the gcd (greatest common divisor) of two polynomials (or of a list of polynomials or of a sequence of polynomials) (see also 5.6.2 for GCD of integers).

Examples
Input :

gcd(x`^`2+2*x+1,x`^`2-1)

Output :

x+1

Input :

gcd(x`^`2-2*x+1,x`^`3-1,x`^`2-1,x`^`2+x-2)

or

gcd([x`^`2-2*x+1,x`^`3-1,x`^`2-1,x`^`2+x-2])

Output :

x-1

For polynomials with modular coefficients, input e.g. :

gcd((x`^`2+2*x+1) mod 5,(x`^`2-1) mod 5)

Output :

x % 5

Note that :

gcd(x`^`2+2*x+1,x`^`2-1) mod 5

will output :

1

since the mod operation is done after the GCD is computed in ℤ[X].