跳到主要内容

LCM

Description

计算两个整数的最小公倍数。注意结果可能会溢出。

Syntax

LCM(<a>, <b>)

Parameters

ParameterDescription
<a>第一个整数
<b>第二个整数

Return Value

返回 <a><b> 的最小公倍数

Examples

select lcm(12, 18);
+------------+
| lcm(12,18) |
+------------+
| 36 |
+------------+
select lcm(0, 10);
+-----------+
| lcm(0,10) |
+-----------+
| 0 |
+-----------+
select lcm(-4, 6);
+------------+
| lcm(-4,6) |
+------------+
| 12|
+------------+
select lcm(-170141183460469231731687303715884105728, 3);
ERROR 1105 (HY000): errCode = 2, detailMessage = Can not convert to legacy literal: 510423550381407695195061911147652317184