# Number of homomorphism, or number of solution to equations, in finite groups

Let $G$ be a finite group, and let $P$ be a finitely generated group. Consider the number $$n=\#Hom_{Grp}(P,G).$$ It is known (see Number of solutions to equations in finite groups) that under relative mild assumptions on $P$ the number $n$ is divisible by $|G|$. I would like to ask if the following is also true:

QUESTION. Are all the prime divisors of $n$ also prime divisors of $|G|$?

More generally, is it true that if we consider ${all}$ finitely presented groups $P$, the collection of numbers $$n_P=\# Hom_{Grp}(P,G)$$ has only finitely many prime divisors (for the given group $G$)? It is true, for quite simple reasons, in case the group $G$ is abelian. I do not know however what happens for a general $G$.

There are $70$ homomorphisms from $\mathbb{Z}\times\mathbb{Z}$ to the dihedral group of order $14$.
• I see now that I made too much haste with this question. We can take the collection of groups $P=\mathbb{Z}/2^r$ and the group $G=S_3$. Then the number of homomorphisms will be $3\cdot 2^r - 2$. Then all the prime numbers $p$ for which $3\in\langle 2 \rangle$ in $(\mathbb{Z}/p)^{\times}$ will appear as prime divisors, and there are infinitely many such. – Ehud Meir Mar 11 '17 at 0:08