Give an example of finitely generated, infinite monoid $M$ with property that for all $m \in M$ we've got $m^2 = m^3$.

This question comes from the problem I was given during algebraic languages theory class at CS department. I've got construction that is using methods outlined during that class but the structure of the monoid is not very clear.

I thought someone could propose more direct construction that would give better insight into methods of constructing such algebraic structures.

In a case there's no better solution I'm planning to share my own with brief explanation of methods used in that construction.

becauseit is homework, but because it is of a level lower than that usually expected on this site. If it is closed, I recommend that you take it to math.stackexchange.com instead. I would also recommend that you give your construction and ask if there is an alternative description that would help you see better what is going on: that would be a more focussed question and easier to answer than the current question. – Andrew Stacey Dec 13 '10 at 12:18