# There is a MathJax command for the GCD. What, if any, is the command for the LCM?

There is $$\gcd(a,b)$$, written as $\gcd(a,b)$. How I can write lcm(a,b), the command $$\lcm(a,b)$$ gives an error.

\operatorname{lcm} or if you use it a lot in a given answer, \DeclareMathOperator{\lcm}{lcm} will make the \lcm command available, but only for that answer.
• I've seen also $\newcommand{\lcm}{\operatorname{lcm}}$ for the same functionality. – Sil Aug 18 '20 at 8:51
• We can also talk about \newcommand{\lcm}{\mathop{\mathrm{lcm}}} if you want to start listing all the equivalent ways of doing that... :-) – Asaf Karagila Aug 18 '20 at 9:10
• Not really, I am sure someone has already did that somewhere (I wonder if they included \text{lcm} there? I wouldn't recommend that one) – Sil Aug 18 '20 at 9:15
• @Sil I'm agree with you. But if you use \text in many cases it is necessary a bit of the space. – Sebastiano Aug 20 '20 at 22:01