TITLE: number of all inconstant maps f from A to A
QUESTION [5 upvotes]: Let $ A=\{1, 2, 3,..., n\}$. Find the number of all nonconstant maps $f: A \rightarrow A$  for which $f(k) \le f(k + 1)$ and $f(k) = f(f(k + 1))$ for $k = 1, \dots, n-1$..

REPLY [2 votes]: Hint: If $f(k+1)>k$ for some $k$, then $f(k)\le f(k+1)\le \cdots\le f(f(k+1))$, but since the last term equals the first all inequalities are equalities, so $f(k)=f(k+1)$.

REPLY [2 votes]: Start with a simple case to see what is going on.  If $n=2$, so that $A = \{1,2\}$, then there are only two non-constant maps:

$f(1) = 2, f(2) = 1$
$g(1) = 1, g(2) = 2$

but the first can't work because it breaks the rule $f(k) \leq f(k+1)$.  As for $g$, we see that $g(1) = 1$, but $g(g(2)) = g(2) = 2$, so it breaks the second rule.
So there are no maps that satisfy the needed conditions for $n=2$.  For $n=3$, there are more maps, but if you not sure what is happening it's good to work these things out to get an idea.
Hint:  draw two columns for A, like this
$1 \qquad 1$
$2 \qquad 2$
$3 \qquad 3$
and indicate the map by drawing arrows from the left column to the right.  Can you describe a rule for the arrows to match the first condition ($f(k) \leq f(k+1))?  What about the second condition?