The lcm command computes the least common multiple of A and B, which can be integers or polynomials. An optional third argument specifies the modulus for polynomial computations modulo a prime.
# integers lcm(10,15); 30 # polynomials lcm(x^2-1,x^3-1); -1-x+x^3+x^4 # polynomials mod p lcm(x^2-1,x^3-1,11); 10+10*x+x^3+x^4