lcm
Least common multiple
Syntax
Description
Examples
Least Common Multiples of Double Array and a Scalar
Least Common Multiples of Unsigned Integers
A = uint16([255 511 15]); B = uint16([15 127 1023]); L = lcm(A,B)
L = 1x3 uint16 row vector
255 64897 5115
Input Arguments
A,B
— Input values
scalars, vectors, or arrays of real, positive integer values
Input values, specified as scalars, vectors, or arrays of real,
positive integer values. A
and B
can
be any numeric type, and they can be of different types within certain
limitations:
If
A
orB
is of typesingle
, then the other can be of typesingle
ordouble
.If
A
orB
belongs to an integer class, then the other must belong to the same class or it must be adouble
scalar value.
A
and B
must be the same
size or one must be a scalar.
Example: [20 3 13],[10 6 7]
Example: int16([100 30 200]),int16([20 15 9])
Example: int16([100 30 200]),20
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
Output Arguments
L
— Least common multiple
real, positive integer values
Least common multiple, returned as an array of real positive
integer values. L
is the same size as A
and B
,
and it has the same type as A
and B
.
If A
and B
are of different
types, then L
is returned as the nondouble type.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Thread-Based Environment
Run code in the background using MATLAB® backgroundPool
or accelerate code with Parallel Computing Toolbox™ ThreadPool
.
This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.
Version History
Introduced before R2006a
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)