# GCD in ℤ/pℤ[x]: Gcd

### 5.35.3 GCD in ℤ/pℤ[x]: Gcd

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 Section 5.28.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 an unspecified number of arguments:
  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)
  Output:

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

  To get the actual greatest common divisor:
  Input:
  eval(ans())
  Output:

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

  Input (in Maple mode):
  Gcd(2*x^2+5,5*x^2+2*x-3) mod 13
  Output:

  x + 2

- Input (in Maple mode):
  Gcd(x^2+2*x,x^2+6*x+5) mod 5
  Output:

  x