Finitely generated implies finitely many homomorphisms to any finite group

Statement
Suppose $$G$$ is a finitely generated group. Then, $$G$$ is a group with finitely many homomorphisms to any finite group. More explicitly, if $$K$$ is a finite group, then the set of homomorphisms from $$G$$ to $$K$$ is finite.

In fact, we have the following explicit upper bound on the number of homomorphisms: if the minimum size of generating set for $$G$$ is $$d$$ and the order of $$K$$ is $$n$$, then the number of homomorphisms from $$G$$ to $$K$$ is $$n^d$$.

Equality holds in the case that $$G$$ is a finitely generated free group of rank $$d$$, though it may also hold in other cases. More generally, equality holds if $$G$$ admits a quotient that is free of rank $$d$$ in the subvariety of the variety of groups generated by $$K$$. For instance, if $$K$$ is abelian, it suffics for $$G$$ have a surjective homomorphism to a free abelian group of rank $$d$$.

Similar facts

 * Finitely presented implies all homomorphisms to any finite group can be listed in finite time

Facts used

 * 1) uses::Homomorphism is determined by its restriction to any generating set

Proof
Given: $$G$$ is a finitely generated group with minimum size of generating set $$d$$ (say with $$S$$ a generating set of minimum size), $$K$$ is a finite group of order $$n$$.

To prove: There are at most $$n^d$$ homomorphisms from $$G$$ to $$K$$.

Proof: By Fact (1), to specify a homomorphism from $$G$$ to $$K$$, it suffices to specify the restriction to the generating set $$S$$. Thus, the total number of homomorphisms from $$G$$ to $$K$$ is bounded by the number of set maps from $$S$$ to $$K$$. By set theory, this number is $$n^d$$.

Comment on equality
Note that the bound is achieved if and only if every set map from $$S$$ to $$K$$ extends to a homomorphism from $$G$$ to $$K$$.