Order of the set of group homomorphisms from $\mathbb{Z}^n$ into an arbitrary finite group $G$. Question: Let a finite $G$ act on itself by conjugation, and let $N$ be the number of conjugacy classes. Find a formula for $|\mathrm{Hom}\left(\mathbb{Z}^n, G\right)|$, denoting the set of group homomorphisms from $\mathbb{Z}^n$ into $G$.
Attempt:
For $n=2$, I got that
Burnside's Lemma implies that
$$
|G|\cdot N = \sum_{g\in G} |\mathrm{Fix}\left(g\right)|
$$
where
$$
\begin{aligned}
\mathrm{Fix}\left(g\right) &= \{ h\in G\;|\;g\ast h = h \} \\
&= \{h\in G\;|\; ghg^{-1} = h \} \\
&= \{ h\in G\;|\; gh = hg \}
\end{aligned}
$$
Hence
$$
\sum_{g\in G} |\mathrm{Fix}\left(g\right)| = | \{ (g,h) \in G\times G\;|\;gh = hg\} | = |\mathrm{Hom}\left(\mathbb{Z}^2, G\right)|
$$
My attempt (for $n=3$):
My guess is that $|\mathrm{Hom}\left(\mathbb{Z}^n, G\right)| = |G|\cdot N^{n-1}$ but I do not know how to prove this or if it's even correct for non-abelian groups $G$. My observation is that for abelian groups $N$ = $|G|$, and for non-abelian groups, $N<|G|$. Intuitively, I would think as $n$ grows large the permutations of objects in $G\times G\times...\times G$ ($n$ times) such that they can be mapped onto by any homomorphism from an abelian group grows faster as $G$ becomes "more abelian", because of the property of homomorphisms.
Construct the function $\Phi:\mathrm{Hom}\left(\mathbb{Z}^3, G\right)\rightarrow G\times G$ where
$$
\Phi\left(\gamma\right) = \left(\gamma\left(1,0,0\right), \gamma\left(0,1,0\right), \gamma\left(0,0,1\right)\right)
$$
$\Phi$ uniquely describes all homomorphisms in the set that we want. We know that this is an injective function and the image consists of ordered triples that commute so:
$$
|\mathrm{Hom}\left(\mathbb{Z}^3, G\right)| = |\{ \left(a,b,c\right)\in G\times G\times G\;|\; ab = ba, ac = ca, bc = cb\}|
$$
Now consider once again $\mathrm{Fix}\left(a\right)$ under the conjugacy action. Both $b$ and $c$ must be in that set, since $a$ commutes with both $b$ and $c$. But in general that doesn't mean $b$ and $c$ commute with each other, but we require that otherwise it can't be a homomorphism.
My first attempt was to find the size of $\mathrm{Fix}\left(a\right)$ first, and then find the size of $\mathrm{Fix}\left(a\right)\cap\mathrm{Fix}\left(b\right)$. But I did not know how to do this or how it relates to the number of conjugacy classes. Not really sure how to proceed after this nor whether this is the right track.
 A: I know this is a really unrigorous answer but this is what I've got. Criticisms are greatly appreciated. I referred to this answer on mathoverflow.
Observe first that $|\mathrm{Hom}\left(\mathbb{Z}^n, G\right)|$ = $|\mathrm{Hom}\left(\mathbb{Z}^{n-1}\times \mathbb{Z}, G\right)|$. Once again, we can uniquely describe each element in that set by describing where they send the bases to; in other words
$$
\Phi_n\left(\gamma_n\right) = \left(\gamma_n\left(1,0,....,0\right), \gamma_n\left(0,1,....,0\right),...,\gamma_n\left(0,0,....,1\right)\right)\quad\text{n times}
$$
But note this is the same as describing where each element sends the first $n-1$ bases to, and then where it sends the $n$th base to. Hence, $\mathrm{im}\left(\Phi_n\right)$ is in bijection with the set of all $\left(\mathrm{im}\left(\Phi_{n-1}\right), g\right)$ where $g\in G$ such that the homomorphism property still holds.
In order for homomorphism to hold, consider an arbitrary $\gamma_{n-1}$ in $\mathrm{Hom}\left(\mathbb{Z}^{n-1}, G\right)$. We have that $\gamma_{n-1}\left(1,0,...,0\right)\ast ...\ast\gamma_{n-1}\left(0,0,...,1\right)$ can commute any way we desire in order to preserve the underlying abelian nature of where the homomorphism is mapping from. Therefore, we require that $\gamma g = g \gamma$. In other words, $g^{-1}\gamma g = \gamma$. Note that this is exactly how we fix objects from $\mathrm{Hom}\left(\mathbb{Z}^{n-1}, G\right)$ by the group action of conjugacy from elements in $G$.
Therefore, consider the group action where $G$ acts on the set $|\mathrm{Hom}\left(\mathbb{Z}^{n-1}, G\right)|$, with conjugacy classes of homomorphisms. Then,
$$
\begin{aligned}
  |\mathrm{Hom}\left(\mathbb{Z}^{n-1}\times \mathbb{Z}, G\right)| &= \sum_{g_{n-1}\in G}|\{ \gamma_{n-1}\in \mathrm{Hom}\left(\mathbb{Z}^{n-1}, G\right)\;|\;g\gamma g^{-1} = \gamma \} \\
  &= \sum_{g_{n-1}\in G}|\mathrm{Fix}\left(g\right)|
  \end{aligned}
$$
Therefore,
$$
|G|\cdot N_{n-1} = \sum_{g_{n-1}\in G}|\mathrm{Fix}\left(g\right)| = |\mathrm{Hom}\left(\mathbb{Z}^{n}, G\right)|
$$
Consider the case where $n=3$, we need to find $N_2$, i.e. the number of conjugacy classes of homomorphisms from $\mathbb{Z}^2$ to $G$. I claim this is $N_1\times N_1$. To loosely argue this, consider that if some $j$ and $k$ are in the same conjugacy class of homomorphisms from $\mathbb{Z}$ to $G$ under operating as $l$, then $\left(j,k\right)$'s are in the same conjugacy class of homomorphisms from $\mathbb{Z}^2$ to $G$ under operating with $l$. Now that we need to count ordered pairs, since in principle $j$ and $k$ could be equal, we need to count it $N_1^2$ times. Hence,
(this part is really sketchy and I don't really know how to formalize it)
$|\mathrm{Hom}\left(\mathbb{Z}^{n}, G\right)| = |G|N^{n-1}$ by induction.
A: Too long for a comment. Here is how you may get a clue as what the formula is. What I do here only holds for abelian groups. 
Let $Z$ be an abelian group.
Consider the map
$$\operatorname{Hom}(X \times Y, Z) \to \operatorname{Hom}(X,Z) \times \operatorname{Hom}(Y,Z): f \mapsto (f_1, f_2)$$
where $f_1(x) = f(x,1)$, $f_2(y) = f(1,y)$. 
Clearly this is well-defined, as we can consider $f_1$ as the composition of the inclusion $x \mapsto (x,1)$ with $f$, both of which are morphisms, so $f_1$ is a morphism itself. Similarly for $f_2$.
To see that it is surjective, let $(f_1, f_2)$ be in the codomain and define 
$$f: X \times Y \to Z: (x,y) \mapsto f_1(x) f_2(y)$$
This is a morphism since $Z$ is abelian and one easily checks that $f \mapsto (f_1, f_2)$
Injectivity follows because $f$ is determined uniquely by $f_1, f_2$ since $f(x,y) = f(x,1) f(1,y)$.
Thus the above map is a bijection. Thus
$$|\operatorname{Hom}(X \times Y, Z)|=| \operatorname{Hom}(X,Z)|| \operatorname{Hom}(Y,Z)|$$
and thus for $n \geq 2$ you get when $G$ is abelian
$$|\operatorname{Hom}(\mathbb{Z}^n, G)| = |\operatorname{Hom}(\mathbb{Z}^{n-1}, G)| |\operatorname{Hom}(\mathbb{Z}, G)|$$
which after an induction reduces the problem to calculating
$$|\operatorname{Hom}(\mathbb{Z},G)|$$
A: There is no formula for the number of such homomorphisms only in terms of $|G|$ and $N$, which the formulation of the question seems to suggest. There are two groups of order 32, both of which have $N = 11$, yet $|\mathrm{Hom}(\mathbb Z^3, G)|$ differs between the group: for one group it is 3200, while for the other it is 4544. (These are the smallest examples for $n = 3$ in terms of order; additionally, there are no counterexamples for $n = 4$ up to order 20.)
To be a bit more precise, $|\mathrm{Hom}(\mathbb Z^3, D_{32})| = 4544$. That the number of conjugacy classes of $D_{32}$ is 11 can be computed "by hand", see for example this SE answer. I don't immediately have an easy answer for why $|\mathrm{Hom}(\mathbb Z^3, D_{32})|$ should take the particular value that it does, but this strikes me as an approachable question.
The other group, let's call it $H$, is a bit more mysterious. GAP describes it as an iterated semidirect product $H = ((C_4 \times C_2) \rtimes C_2) \rtimes C_2$, but my GAP skills are not strong enough to investigate further. But indeed computations confirm that $|\mathrm{Hom}(\mathbb Z^3, H)| = 3200$. This group $H$ has index 6 in GAP's list of groups of order 32.
