Idempotent endomorphism on finite monogenic monoid onto its subgroup Let $S = \langle x ;x^m = x^{m+n} \rangle $ be a monogenic monoid, where $m,n\in\mathbb N$ are least such that $a^m = a^{m+n}$. Then $S$ contains its maximal subgroup $G\cong \mathbb Z_n$.

Define a homomorhpism $\varphi : S\to S$ such that $\varphi (S) = G$ and $\varphi^2 =\varphi$

We need to map everything onto $G = \{a^m, a^{m+1},\ldots, a^{m+n-1}\}$.
Does anyone have any ideas/clues?

Hint. Let $e$ be the idempotent of $G$. Then define $\varphi$ by setting $\varphi(s) = se$.
