跳到主要内容

GCD

Description

计算两个整数的最大公约数。

Syntax

GCD(<a>, <b>)

Parameters

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

Return Value

返回值为 <a><b> 的最大公约数

Examples

select gcd(54, 24);
+------------+
| gcd(54,24) |
+------------+
| 6 |
+------------+
select gcd(-17, 31);
+-------------+
| gcd(17,31) |
+-------------+
| 1 |
+-------------+
select gcd(0, 10);
+-----------+
| gcd(0,10) |
+-----------+
| 10 |
+-----------+