Number of elements of a certain order of a direct product of finite cyclic groups. 
Let $G_1$ and $G_2$ be cyclic finite groups. Suppose I wanted to find the number of elements in $G_1 \times G_2$ of order k. How would I do that?

I've tried using the fact that if $g_1 \in G_1$ and $g_2 \in G_2$, then $|(g_1, g_2)| = \operatorname{lcm}(|g_1|, |g_2|)$, but no such luck.
I appreciate any help given. 
 A: The number of elements of order $k$ in a finite group $G$ is $\Omega_k(G) - \omega_k(G)$, where

*

*$\Omega_k(G)$ is the number of elements of G with order dividing $k$

*$\omega_k(G)$ is the number of elements of G with order strictly dividing $k$ (i.e. dividing, but not equal to, $k$)

If $G \cong G_1 \times \cdots \times G_n$, then I claim

*

*$\Omega_k(G) = \Omega_k(G_1) \times \cdots \times \Omega_k(G_n)$

*$\omega_k(G) = \omega_k(G_1) \times \cdots \times \omega_k(G_n)$
Sketch proof: $g = (g_1, \dots, g_n) \in G$ has order dividing $k$ $\iff g^k = 1 \iff \forall i: g_i^k = 1 \iff $ each $g_i$ has order dividing $k$. In order for $g$ to not have order $k$, we need each of the $g_i$ to not have order $k$.
So if $G$ is the product of cyclic groups, it suffices to compute $\Omega_k(C_n)$ and $\omega_k(C_n)$, for arbitrary $n \in \mathbb{N}.$ You can check the following:

*

*$\Omega_k(C_n) = \textrm{gcd}(k, n)$

*$ \omega_k(C_N) =
  \begin{cases}
    \text{gcd}(k, n) - \phi(k)       & \quad \text{if } k | n \\
    \text{gcd}(k, n) & \quad \text{otherwise}
  \end{cases} $
where $\phi(k)$ is the totient of $k$.
A: I assume $k$ is a divisor of $|G_1 \times G_2|$. There are two cases


*

*$G_1 \times G_2$ is cyclic (this may happen when $\gcd(|G_1|,|G_2|)=1$ ) . 


Since $G_1 \times G_2$ is cyclic, it has a unique subgroup of order $k$, call it as $\langle a \rangle$. Then every element of order $k$ also generates the subgroup  $\langle a \rangle$ and note that $a^m$ generates $\langle a \rangle$ iff $\gcd(m,k)=1$. The number of such element is exactlty $\phi(k)$ where $\phi$ is Euler totient function 
Conclusion: In a finite cyclic group, the number of elements of order $k$ is exactly $\phi(k)$


*

*$G_1 \times G_2$ is not cyclic 


In this case, there is no formula for the number of elements of each order. We must find explicitly by using your $\text{lcm}$ formula,  but we can still say something, namely, 
the number of elements of order $k$ is a multiple of $\phi(k)$ (proof?) 
