Function Repository Resource:

CommonMultiples

Source Notebook

Find the common multiples of two or more integers

Contributed by: Wolfram|Alpha Math Team

ResourceFunction["CommonMultiples"][n,m]

gives the first m multiples of an number n.

ResourceFunction["CommonMultiples"][{n1,n2,},m]

gives the first m common multiples of the numbers ni.

ResourceFunction["CommonMultiples"][input]

gives the first 10 multiples.

ResourceFunction["CommonMultiples"][,"Grid"]

displays the multiples in a grid format.

Details and Options

ResourceFunction["CommonMultiples"] works not only with integers but also with rational numbers, both real and complex.
The numbers in the first argument of ResourceFunction["CommonMultiples"] must be exact, not approximate, numbers.

Examples

Basic Examples (4) 

Compute the first ten multiples of an integer:

In[1]:=
ResourceFunction["CommonMultiples"][4]
Out[1]=

Compute the first 10 common multiples of a list of integers:

In[2]:=
ResourceFunction["CommonMultiples"][{4, 6, 100}]
Out[2]=

Compute only four common multiples:

In[3]:=
ResourceFunction["CommonMultiples"][{3, 6}, 4]
Out[3]=

Make a grid of common multiples:

In[4]:=
ResourceFunction["CommonMultiples"][{10, 25}, 6, "Grid"]
Out[4]=

Scope (2) 

CommonMultiples can accept fractions:

In[5]:=
ResourceFunction["CommonMultiples"][{3/7, 2/3}, 4]
Out[5]=

CommonMultiples can accept complex numbers:

In[6]:=
ResourceFunction["CommonMultiples"][{1 + I, 3/2}, 4]
Out[6]=

Possible Issues (2) 

The numbers in the first argument of CommonMultiples must be exact, not approximate, numbers:

In[7]:=
ResourceFunction["CommonMultiples"][0.4, 3]
Out[7]=

CommonMultiples additionally requires its inputs to be rational:

In[8]:=
ResourceFunction["CommonMultiples"][Sqrt[2], 4]
Out[8]=
In[9]:=
ResourceFunction["CommonMultiples"][{Pi, E}]
Out[9]=

Publisher

Wolfram|Alpha Math Team

Version History

  • 5.0.0 – 23 March 2023
  • 4.0.0 – 16 April 2020
  • 3.0.0 – 24 January 2020
  • 2.0.0 – 06 September 2019
  • 1.0.0 – 23 July 2019

Related Resources

License Information