From 3:00AM CST Saturday, August 15 – 10:00PM CST Saturday August 15, ni.com will be undergoing system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LCM (G Dataflow)

Version:

Computes the least common multiple of the input values.

An integer.

An integer.

error in

Error conditions that occur before this node runs.

The node responds to this input according to standard error behavior.

Standard Error Behavior

Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

error in does not contain an error error in contains an error
If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

Default: No error

LCM(x, y)

Least common multiple of x and y.

error out

Error information.

The node produces this output according to standard error behavior.

Standard Error Behavior

Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

error in does not contain an error error in contains an error
If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

Algorithm for Computing the Least Common Multiple

LCM(x,y) is the smallest integer m for which there exist integers c and d such that

$x×c=y×d=m$

To compute LCM(x,y), consider the prime factorizations of x and y:

$x=\underset{i}{\prod }{{p}_{i}}^{{a}_{i}}$
$y=\underset{i}{\prod }{{p}_{i}}^{{b}_{i}}$

where pi are all the prime factors of x and y. If pi does not occur in a factorization, the corresponding exponent is 0. LCM(x,y) then is given by:

$\mathrm{LCM}\left(x,y\right)=\underset{i}{\prod }{{p}_{i}}^{\mathrm{max}\left({a}_{i},{b}_{i}\right)}$

The prime factorizations of 12 and 30 are given by:

$12={2}^{2}×{3}^{1}×{5}^{0}$
$30={2}^{1}×{3}^{1}×{5}^{1}$

so

$\mathrm{LCM}\left(12,30\right)={2}^{2}×{3}^{1}×{5}^{1}=60$

Where This Node Can Run:

Desktop OS: Windows

FPGA: This product does not support FPGA devices