up previous next

GCD, LCM

Syntax

GCD (F_1:INT,...,F_n:INT):INT
GCD (L:LIST of INT):INT
LCM (F_1:INT,...,F_n:INT):INT
LCM (L:LIST of INT):INT

GCD(F_1:POLY,...,F_n:POLY):POLY
GCD (L:LIST of POLY):POLY
LCM(F_1:POLY,...,F_n:POLY):POLY
LCM (L:LIST of POLY):POLY
    

Summary

greatest common divisor, least common multiple

Description

These functions return the greatest common divisor and least common multiple, respectively, of F_1,...,F_n or of the elements in the list L. For the calculation of the GCDs and LCMs of polynomials, the coefficient ring must be a field.

example

    
Use R ::= Q[x,y];
F := x^2-y^2;
G := (x+y)^3;
GCD(F,G);
x + y
-------------------------------
LCM(F,G);
1/4x^4 + 1/2x^3y - 1/2xy^3 - 1/4y^4
-------------------------------
4It = (x+y)^3(x-y);
TRUE
-------------------------------
GCD(3*4,3*8,6*16);
12
-------------------------------
GCD([3*4,3*8,6*16]);
12
-------------------------------
        
    

See Also