For a (multiplicative) group $G$ and $g\in G$, set $|g|=m\gt 0$ if $g^m=1$ and $g^k\neq 1$ for all $k$, $0\lt k\lt m$; and $|g|=0$ if $g$ is not a torsion element.
If $G_1,\ldots,G_n$ are a finite collection of groups, then $|(g_1,\ldots,g_n)| = \mathrm{lcm}(|g_1|,|g_2|,\ldots,|g_n|).$ (Prove it; remember that $\mathrm{lcm}(0,n) = 0$ for all $n$).
More generally, if $G$ is a group, $g_1$ and $g_2$ are two elements that commute, and $\langle g_1\rangle\cap\langle g_2\rangle = \{1\}$, then $|g_1g_2| = \mathrm{lcm}(|g_1|,|g_2|)$: since $g_1$ and $g_2$ commute, then $(g_1g_2)^n = g_1^ng_2^n$. If $(g_1g_2)^k = 1$, then $g_1^kg_2^k=1$, so $g_1^k = g_2^{-k}\in\langle g_1\rangle\cap\langle g_2\rangle=\{1\}$, so $g_1^k = g_2^k = 1$, hence $|g_1|$ divides $k$, and $|g_2|$ divides $k$.