For $C_6$, observe that $\gamma_C(1)=1$, $\gamma_C(2)=1$, $\gamma_C(3)=2$ and $\gamma_C(6)=2$.
The order of an element $(a,b)$ with $a,b\in C_6$ is the lcm of their respective orders and hence is again a divisor of $6$.
Therefore we have $\gamma_G(1)=\gamma_C(1)^2=1$ as $(a,b)$ has order $1$ iff both $a$ and $b$ have order $1$.
For bigger orders $m$ it seems easier to compute the number of pairs $(a,b)$ that have order that is a divisor of $m$ (instead of exactly $m$).
For example, $(a,b)$ has order dividing $2$ (i.e. equal to $1$ or $2$) iff both $a$ and $b$ have order dividing $2$ (i.e. equal to $1$ or $2$). Thus we conclude $$\begin{align}
\gamma_G(1)&=&\gamma_C(1)^2&=&1\\
\gamma_G(2)+\gamma_G(1)&=&(\gamma_C(2)+\gamma_C(1))^2&=&4\\
\gamma_G(3)+\gamma_G(1)&=&(\gamma_C(3)+\gamma_C(1))^2&=&9\\
\gamma_G(6)+\gamma_G(3)+\gamma_G(2)+\gamma_G(1)&=&(\gamma_C(6)+\gamma_C(3)+\gamma_C(2)+\gamma_C(1))^2&=&36&.\end{align}$$
Solving these equations, we obtain therefore $\gamma_G(1)=1$, $\gamma_G(2)=3$, $\gamma_G(3)=8$, $\gamma_G(6)=24$.
Note that $20 = 2^2 \cdot 5$.
By Fundamental theorem of Finitely Generated Abelian Group, there are two distinct abelian groups of order $20$: $\mathbb{Z}_{20}$ and $\mathbb{Z}_{10} \times \mathbb{Z}_2$.
Now let $G$ be a nonabelian group of order $20$. By Sylow’s Theorem, $n_5 = 1$, so that $G$ has a unique (hence normal) Sylow $5$-subgroup $H \cong \mathbb{Z}_5$. Now let $K$ be any Sylow $2$-subgroup of $G$. By Lagrange, we have $H \cap K = 1$, so that $G = HK$. By the recognition theorem for semidirect products, $G \cong H \rtimes_\varphi K$ for some $\varphi : K \rightarrow \mathsf{Aut}(H)$. Evidently, classifying the nonabelian groups of order $20$ is equivalent to determining the nonisomorphic groups constructed in this manner. To that end, let $H = \mathbb{Z}_5 = \langle y \rangle$. Note that $\mathsf{Aut}(H) = \langle \alpha \rangle \cong \mathbb{Z}_4$; where $\alpha(y) = y^2$.
Let $K = \mathbb{Z}_4 = \langle x \rangle$. There are four distinct homomorphisms $K \rightarrow \mathsf{Aut}(H)$.
If $\varphi_1(x) = 1$, then $\varphi_1$ is trivial; this contradicts the nonabelianicity of $G$.
If $\varphi_2(x) = \alpha$, then $\mathbb{Z}_5 \rtimes_{\varphi_2} \mathbb{Z}_4 $is indeed a nonabelian group of order $20$.
If $\varphi_3(x) = \alpha^2$, then $\mathbb{Z}_5 \rtimes_{\varphi_3} \mathbb{Z}_4$ is indeed a nonabelian group of order $20$. Moreover, since $\mathsf{ker}\ \varphi_3 \cong \mathbb{Z}_2$ and $\mathsf{ker}\ \varphi_2 \cong 1$,$ H \rtimes_{\varphi_3} K \not\cong H \rtimes_{\varphi_2} K$.
If $\varphi_4(x) = \alpha^3$, then $\mathsf{im}\ \varphi_4 = \mathsf{im}\ \varphi_2$. Since $\mathbb{Z}_4$ is cyclic, by a previous theorem, $H \rtimes_{\varphi_4} K \cong H \rtimes_{\varphi_2} K$.
Thus there are two distinct groups of order 20 which have a cyclic Sylow 2-subgroup.
Suppose now that $K = \mathbb{Z}_2^2 = \langle a \rangle \times \langle b \rangle$. Again, $\psi : \mathbb{Z}_2^2 \rightarrow \mathbb{Z}_4$ is determined uniquely by $\psi(a)$ and $\psi(b)$, and is indeed a homomorphism provided $|\psi(a)|$ and $|\psi(b)|$ divide $2$. We thus have $\psi(a)$, $\psi(b) \in \{ 1, \alpha^2 \}$, for a total of four choices.
If $\psi_1(a) = \psi_1(b) = 1$, then $\psi_1 = 1$, contradicting the nonabelianicity of $G$.
If $\psi_2(a) = \alpha^2$ and $\psi_2(b) = 1$, then $\mathbb{Z}_5 \rtimes_{\psi_2} \mathbb{Z}_2^2$ is indeed a nonabelian group of order $20$.
If $\psi_3(a) = 1$ and $\psi_3(b) = \alpha^2$, then $\varphi_3 = \varphi_2 \circ \theta$, where $\theta(a) = b$ and $\theta(b) = a$. Clearly $\theta$ is an automorphism of $\mathbb{Z}_2^2$. By a lemma to a previous theorem, we have $H \rtimes_{\psi_3} K \cong H \rtimes_{\psi_2} K$.
If $\psi_4(a) = \alpha^2$ and $\psi_4(b) = \alpha^2$, then $\psi_4 = \psi_2 \circ \theta$, where $\theta(a) = a$ and $\theta(b) = ab$. Clearly $\theta$ is an automorphism of $\mathbb{Z}_2^2$. By a lemma to a previous theorem, we have $H \rtimes_{\psi_4} K \cong H \rtimes_{\psi_2} K$.
Thus there is a unique nonabelian group of order 20 which has an elementary abelian Sylow 2-subgroup.
In summary, the distinct groups of order $20$ are as follows. We let $\mathbb{Z}_5 = \langle y \rangle$, $\mathbb{Z}_4 = \langle x \rangle$, and $\mathbb{Z}_2^2 = \langle a \rangle \times \langle b \rangle$.
$Z_{20}$,
$Z_{10} \times Z_2$,
$Z_5 \rtimes_{\varphi_3} Z_4$, where $\varphi_3(x)(y) = y^{-1}$.
$Z_5 \rtimes_{\varphi_2} Z_4$, where $\varphi_2(x)(y) = y^2$
$Z_5 \rtimes_\psi Z_2^2$, where $\psi(a)(y) = y^{-1}$ and $\psi(b)(y) = y$.
(Source: Crazyproject)
Best Answer
Here is one family of such groups.
The nonabelian group of order $p^3$ and exponent $p$ can be realized as the multiplicative group of $3\times 3$ unipotent matrices with coefficients in $\mathbb{Z}/p\mathbb{Z}$, i.e., matrices of the form $$\left(\begin{array}{ccc} 1 & a & c\\ 0 &1 & b\\ 0 & 0 & 1 \end{array}\right),\qquad a,b,c\in \mathbb{Z}/p\mathbb{Z}.$$ In this group, every nontrivial element has order $p$, and so you get the same count as you do for the abelian (an dhence non-isomorphic) group $(\mathbb{Z}/p\mathbb{Z})^3$.
You can also construct further examples, known as extra-special $p$-groups (of exponent $p$), by taking central products of copies of the group above. Let us denote the group above by $\mathbf{E}_3$ ($E$ for "extra-special"; it's a technical term). Note that the center is cyclic of order $3$, given by the matrices with $a=b=0$. Now, we construct $\mathbf{E}_5$ by taking $\mathbf{E}_3\times\mathbf{E}_3/N$, where $N$ is group of elements of the form $(z,z^{-1})$ with $z\in Z(\mathbf{E}_3)$ (this "identifies" the centers of each copy of $\mathbf{E}_3$). This is again a nonabelian group of exponent $p$, with center of order $p$, of order $p^5$.
Assuming we have defined $\mathbf{E}_{2n+1}$, nonabelian group of order $p^{2n+1}$, exponent $p$, and center of order $p$, we construct $\mathbf{E}_{2n+3}$ by identifying generators $w$ and $z$ of $Z(\mathbf{E}_{2n+1})$ and $Z(\mathbb{E}_3)$, and constructing $\mathbf{E}_{2n+1}\times\mathbf{E}_3/N$, where $N$ consists of the elements of the form $(w^k,z^{-k})$. This will be a nonabelian group of order $p^{2n+3}$, exponent $p$, with center of order $p$.
Then $\mathbf{E}_{2k+1}$ and $(\mathbb{Z}/p\mathbb{Z})^{2k+1}$ will have the desired property, for all $k\geq 1$.
Now, say you have (finite) groups $G$ and $H$ as desired (nonisomorphic, but for each $k$ the number of elements of order $k$ in $G$ and $H$ are the same). Let $K$ be any finite group. I claim that $G\times K$ and $H\times K$ also satisfy the desired properties. That they are not isomorphic is not trivial, but nonetheless it is true (e.g., it follows from the Remak-Krull-Schmidt Theorem). Now I claim that for every $r$, the number of elements of order $r$ in $G\times K$ and in $H\times K$ is the same.
An element $(g,k)\in G\times K$ has order $r$ if and only if (i) the order of $g$ divides $r$; (ii) the order of $k$ divides $r$; and (iii) at least one of the orders of $g$ and $k$ is exactly equal to $r$. Thus, letting $G(d)$ be the set of elements of $G$ of order exactly $d$, and similarly for $H(d)$ and $K(d)$, we have that $$(G\times K)(r) = \left(\sum_{d|r}|G(d)||K(r)|\right) + \left(\sum_{d|r}|G(r)||K(d)|\right) - |G(d)||K(d)|.$$ Similarly, $$(H\times K)(r) = \left(\sum_{d|r}|H(d)||K(r)|\right) + \left(\sum_{d|r}|H(r)||K(d)|\right) - |H(d)||K(d)|.$$ Since $|G(m)|=|H(m)|$ for all $m$ by assumption, it follows that $|(G\times K)(r)|=|(H\times K)(r)|$.
An interesting question might be to determine all $n$ for which there exist two non-isomorphic groups $G$ and $H$ of order $n$ for which the count of elements of order $k$ is equal for all $k$. From the above, we see that if $n$ divisible by the cube of an odd prime, or by $16$, then such groups exist. We also know that if $n$ is cubefree and a nilpotent number, then every group of order $n$ is abelian, so no such examples exist. This reduces the problem to $n$ that is cubefree but not a nilpotent number, and to numbers of the form $2^km$ where $m$ is odd and cubefree, $k=3$. I expect counterexamples exist in that case as well.