Function reference · Algebra

lcm

Returns the least common multiple of two polynomials or numbers.

Shared factors appear once in the result. If either argument is zero, the result is zero.

Notation

lcm(x, y)

Write it in an expression: nerdamer('lcm(6,4)'), or in the Playground.

nerdamer.lcm

nerdamer.lcm(x: ExpressionInput, y: ExpressionInput): Expression

A method on the default import. Arguments can be strings, as in Notation.

import { lcm }

import { lcm } from 'nerdamer/algebra';
lcm(x: ExpressionInput, y: ExpressionInput): Expression

Import only this function, from nerdamer/algebra.

Examples

Two integers.

lcm(6,4)
// → 12
Open in Playground

The shared factor x-1 appears once.

lcm((x-1)*(x+2),(x-1)*(x+3))
// → (2+x)*(3+x)*(-1+x)
Open in Playground

Zero gives zero.

lcm(0,x)
// → 0
Open in Playground

← Back to Function reference