WOLFRAM

LCM[n1,n2,]

gives the least common multiple of the ni.

Details

  • LCM is also known as smallest common multiple.
  • Integer mathematical function, suitable for both symbolic and numerical manipulation.
  • LCM[n1,n2,] is the smallest positive integer that is a multiple of each of the integers n1,n2,.
  • For rational numbers ri, LCM[r1,r2,] gives the least rational number r for which all the r/ri are integers.
  • LCM works over Gaussian integers.

Examples

open allclose all

Basic Examples  (2)Summary of the most common use cases

Find the least common multiple of a set of numbers:

Out[1]=1

Plot the least common multiple for a number with :

Out[1]=1

Scope  (11)Survey of the scope of standard use cases

Numerical Evaluation  (7)

LCM works over integers:

Out[1]=1

Gaussian integers:

Out[1]=1

Real rational numbers:

Out[1]=1

Complex rational numbers:

Out[1]=1

The one-argument form is identity for positive integers:

Out[1]=1

Compute for large integers:

Out[1]=1

LCM threads elementwise over lists:

Out[1]=1

Symbolic Manipulation  (4)

TraditionalForm formatting:

Reduce inequalities:

Out[1]=1

Solve equations:

Out[1]=1

Simplify expressions:

Out[1]=1
Out[2]=2

Applications  (9)Sample problems that can be solved with this function

Basic Applications  (4)

Table of the LCMs of the first 100 pairs of integers:

Out[2]=2

Visualize the LCMs of two integers:

Out[1]=1

Fibonacci numbers:

Out[2]=2

The LCM of the first 100 integers:

Out[1]=1

Compute LCM for positive integers:

Out[2]=2

Compare with:

Out[3]=3

Number Theory  (5)

Cumulative LCMs:

Out[1]=1

Plot the logarithm of the data (if Riemann's hypothesis holds, this grows linearly):

Out[2]=2

The sum of MangoldtLambda of the first n integers is equal to the natural log of the LCM of the first n integers:

Out[1]=1
Out[2]=2

Maximal order of group elements from the symmetric group of order n (Landau's function):

Out[1]=1

LCMs of binomial coefficients:

Out[1]=1

Compare with:

Out[2]=2

Simplify expressions containing LCM:

Out[1]=1
Out[2]=2
Out[3]=3

Properties & Relations  (7)Properties of the function, and connections to other functions

Every divisor of a and b is a divisor of :

Out[1]=1

Use GCD to compute LCM:

Out[1]=1

Compare with:

Out[2]=2

The LCM of coprime numbers is equal to their product:

Out[1]=1
Out[2]=2

LCM for prime numbers is their product:

Out[1]=1
Out[2]=2

LCM for prime power representation :

Out[2]=2

LCM is commutative :

Out[1]=1

LCM is associative :

Out[2]=2

LCM is distributive :

Out[3]=3

Use LCM to compute MangoldtLambda:

Out[1]=1

Compare with:

Out[2]=2

Possible Issues  (3)Common pitfalls and unexpected behavior

Signs are discarded:

Out[1]=1

The arguments must be explicit integers:

Out[1]=1

LCM sorts its arguments:

Out[1]=1

Interactive Examples  (1)Examples with interactive outputs

Visualize the LCMs of three numbers:

Out[1]=1

Neat Examples  (4)Surprising or curious use cases

Visualize the LCMs of Fibonacci numbers:

Out[10]=10

Plot the arguments of the Fourier transform of the LCM:

Out[1]=1

Plot the Ulam spiral of the LCM:

Out[2]=2

Form the LCMs of with rational numbers:

Out[1]=1
Wolfram Research (1988), LCM, Wolfram Language function, https://reference.wolfram.com/language/ref/LCM.html (updated 1999).
Wolfram Research (1988), LCM, Wolfram Language function, https://reference.wolfram.com/language/ref/LCM.html (updated 1999).

Text

Wolfram Research (1988), LCM, Wolfram Language function, https://reference.wolfram.com/language/ref/LCM.html (updated 1999).

Wolfram Research (1988), LCM, Wolfram Language function, https://reference.wolfram.com/language/ref/LCM.html (updated 1999).

CMS

Wolfram Language. 1988. "LCM." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 1999. https://reference.wolfram.com/language/ref/LCM.html.

Wolfram Language. 1988. "LCM." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 1999. https://reference.wolfram.com/language/ref/LCM.html.

APA

Wolfram Language. (1988). LCM. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/LCM.html

Wolfram Language. (1988). LCM. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/LCM.html

BibTeX

@misc{reference.wolfram_2025_lcm, author="Wolfram Research", title="{LCM}", year="1999", howpublished="\url{https://reference.wolfram.com/language/ref/LCM.html}", note=[Accessed: 23-March-2025 ]}

@misc{reference.wolfram_2025_lcm, author="Wolfram Research", title="{LCM}", year="1999", howpublished="\url{https://reference.wolfram.com/language/ref/LCM.html}", note=[Accessed: 23-March-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_lcm, organization={Wolfram Research}, title={LCM}, year={1999}, url={https://reference.wolfram.com/language/ref/LCM.html}, note=[Accessed: 23-March-2025 ]}

@online{reference.wolfram_2025_lcm, organization={Wolfram Research}, title={LCM}, year={1999}, url={https://reference.wolfram.com/language/ref/LCM.html}, note=[Accessed: 23-March-2025 ]}