# Greatest common divisor (gcd)

Greatest common divisor of whole numbers.

## How to write it

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

**a**

A whole number. Takes a whole number.

**b**

A whole number. Takes a whole number.

## Examples

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

  `gcd(12, 18)`

  In the solver, `gcd(12, 18)` gives `6`.

  [Open in the solver](https://hilberon.com/?q=gcd%2812%2C%2018%29)
- $\displaystyle \gcd(12, 18, 24) = 6$

  `gcd(12, 18, 24)`

  In the solver, `gcd(12, 18, 24)` gives `6`.

  [Open in the solver](https://hilberon.com/?q=gcd%2812%2C%2018%2C%2024%29)

## Related functions

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

  Imaginary part of a complex number.
- [frac](https://hilberon.com/library/frac)

  Fractional part of a number.
- [lcm](https://hilberon.com/library/lcm)

  Least common multiple of whole numbers.
- [floor](https://hilberon.com/library/floor)

  Greatest whole number not above a number.
- [log](https://hilberon.com/library/log)

  Logarithm: natural with ln, or to any base with log.
- [factorial](https://hilberon.com/library/factorial)

  Factorial: n! is the product of the whole numbers from 1 to n.

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