The lcm command will compute the least common multiple of an arbitrary number of polynomials, where the gcd command will compute the greatest common divisor of two polynomials.
Note that the arguments must be polynomials in all the indeterminates, otherwise an error is returned:
However, when a name appears inside a radical or a RootOf representing an algebraic function, then it is considered as an element of the coefficient field. In the following example, a greatest common divisor in Q(x^(1/2))[y] is computed: