Documentation/Calc Functions/LCM

From The Document Foundation Wiki
Jump to: navigation, search

Other languages:

Function name:

LCM

Category:

Mathematical

Summary:

LCM gives the least common multiple of one or more positive integers.

Syntax:

LCM(Integer 1 [; Integer 2 [; … [; Integer 255]]])

Returns:

Returns an integer value which is the least common multiple of one or more positive integers passed as input.

Arguments:

Integer 1, Integer 2, … , Integer 255 are integers, references to cells or to cell ranges of integers.

  • If any argument is negative, the function returns an error value.
  • If any argument is non-integer, the function returns an integer LCM value. For e.g. LCM(2.5;5) will return 10 while LCM(8;2.2) will return 8.

Additional details:

If given two positive integers, a*b=LCM(a;b)*GCD(a;b).

Examples:

Formula Description Returns
=LCM(16;32;24) the least multiple common to 16, 24 and 32 96
=LCM(B1:B3) ,where cells B1, B2, B3 contain 9, 12, 9 the least multiple common to 9, 12 and 9 36
=LCM(-16;32;24) function returns an error value since one of the arguments is negative Err:502

Related LibreOffice functions:

LCM_EXCEL2003

GCD

ODF standard:

Section6.16.38, part2

Equivalent Excel functions:

LCM