Sponsored links: Algebra eBooks ### The Maxima on-line user's manual

Algebra Calculator

#### Search: #### Gcd

Function: gcd (<p_1>, <p_2>, <x_1>, ...) Returns the greatest common divisor of <p_1> and <p_2>. The flag `gcd` determines which algorithm is employed. Setting `gcd` to `ez`, `subres`, `red`, or `spmod` selects the `ezgcd`, subresultant `prs`, reduced, or modular algorithm, respectively. If `gcd` `false` then `gcd (<p_1>, <p_2>, <x>)` always returns 1 for all <x>. Many functions (e.g. `ratsimp`, `factor`, etc.) cause gcds to be taken implicitly. For homogeneous polynomials it is recommended that `gcd` equal to `subres` be used. To take the gcd when an algebraic is present, e.g., `gcd (<x>^2 - 2*sqrt(2)*<x> + 2, <x> - sqrt(2))`, `algebraic` must be `true` and `gcd` must not be `ez`. The `gcd` flag, default: `spmod`, if `false` will also prevent the greatest common divisor from being taken when expressions are converted to canonical rational expression (CRE) form. This will sometimes speed the calculation if gcds are not required.

There are also some inexact matches for `gcd`. Try `?? gcd` to see them.

```(%o1)                                true
(%i2) ```

### Related Examples

p:7;

q:167;

n:p*q;

Calculate

##### gcd

gcd(3358476,750485);

Calculate

##### gcd

gcd((x+1)^5 + 3, x^5 ...

Calculate

gcd(180,87);

Calculate

p:47;

q:53;

n:p*q;

Calculate

gcd(411601,173);

Calculate

##### gcd-gcdex

gcd(3275344,49722);

gcdex(3275344,2910351);

Calculate

p:61;

q:53;

n:p*q;

Calculate

x:347;

y:183;

gcd(x,y);

Calculate

##### gcd

gcd(1+m,b2-b3+b2*m-b3...

Calculate 