Daily bit(e) of C++ | std::gcd, std::lcm
Daily bit(e) of C++ #211, The C++17 greatest common divisor and least common multiple algorithms: std::gcd and std::lcm.
The greatest common divisor and least common multiple are often used as simple programming exercises or interview questions.
Since C++17, we finally have the standard versions of these functions as std::gcd and std::lcm in the numeric header.