### 11.9.3 GCD in ℤ/pℤ[x]

In Xcas mode, Gcd is simply the inert form of gcd; namely, it returns the greatest common divisor of two polynomials without evaluation. (See Section 11.2.5.) In Maple mode, the Gcd command can additionally be used in conjunction with mod to compute the greatest common divisor of two polynomials with coefficients in ℤ/pℤ.

- In Maple mode, Gcd takes polys, a sequence or list of polynomials with coefficients in ℤ/pℤ.
- Gcd(polys) returns the greatest common divisor of the polynomials in polys.

#### Examples

Input in Xcas mode:

Gcd(2*x^2+5%13,5*x^2+2*x-3%13)

gcd | ⎛ ⎝ | 2 x2+5%13,5 x2+2 x+ | ⎛ ⎝ | −3 | ⎞ ⎠ | %13 | ⎞ ⎠

To get the actual greatest common divisor:

eval(ans())

| ⎛ ⎝ | 1%13 | ⎞ ⎠ | x+2%13

Input in Maple mode:

Gcd(2*x^2+5,5*x^2+2*x-3) mod 13

x+2 |  |  |  |  |  |  |  |  |  |

Gcd(x^2+2*x,x^2+6*x+5) mod 5

x |  |  |  |  |  |  |  |  |  |