> For the complete documentation index, see [llms.txt](https://liuzhenglaichn.gitbook.io/algorithm/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://liuzhenglaichn.gitbook.io/algorithm/math/lcm.md).

# Lcm

```cpp
lcm(a, b) = a * b / gcd(a, b)
lcm(a, b, c) = lcm(lcm(a, b), c)
```

## std::lcm

In STL, there is a built-in `std::lcm`
