Skip to Main Content Skip to Search
Product Documentation

lcm - Least common multiple

Syntax

L = lcm(A,B)

Description

L = lcm(A,B) returns the least common multiple of corresponding elements of arrays A and B. Inputs A and B must contain positive integer elements and must be the same size (or either can be scalar).

Examples

lcm(8,40)

ans =

    40
lcm(pascal(3),magic(3))

ans =
     8     1     6
     3    10    21
     4     9     6

See Also

gcd

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS