# 最大公约数（Greatest common divisor，gcd）

整数的最大公约数。

## 怎么写

### gcd(a, b, ...)

**a**

一个整数。接受一个整数。

**b**

一个整数。接受一个整数。

## 示例

- $\displaystyle \gcd(12, 18) = 6$

  `gcd(12, 18)`

  在求解器中，`gcd(12, 18)` 的结果是 `6`。

  [在求解器中打开](https://zh.hilberon.com/?q=gcd%2812%2C%2018%29)
- $\displaystyle \gcd(12, 18, 24) = 6$

  `gcd(12, 18, 24)`

  在求解器中，`gcd(12, 18, 24)` 的结果是 `6`。

  [在求解器中打开](https://zh.hilberon.com/?q=gcd%2812%2C%2018%2C%2024%29)

## 相关函数

- [im](https://zh.hilberon.com/library/im)

  复数的虚部。
- [frac](https://zh.hilberon.com/library/frac)

  一个数的小数部分。
- [lcm](https://zh.hilberon.com/library/lcm)

  若干整数的最小公倍数。
- [floor](https://zh.hilberon.com/library/floor)

  不超过某数的最大整数。
- [log](https://zh.hilberon.com/library/log)

  对数：ln 为自然对数，log 可指定任意底数。
- [factorial](https://zh.hilberon.com/library/factorial)

  阶乘：n! 是从 1 到 n 的所有整数的乘积。

---
Source: https://zh.hilberon.com/library/gcd
