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$.