The following problem was given at IMO 1987.
Prove that there is no function f from the set of non-negative integers into itself such that $f(f(n)) = n + 1987$ for every $n$.
So I tried to generalize the problem, and my formulation is:
Let $2 \leq a$ and $b$ be positive integers. Find the number of functions $f$ from the set of non-negative integers into itself such that $f^{(a)}(n)= n + b$ for every $n$.
where $f^{(a)}$ is $f$ iterated $a$ times.
I proved the following results :
There is no function if $a\nmid b$ (does not divide) Using the same method as for the problem in IMO.
solution(1) see here
$a=2$ , if b is even then I proved that the number of possible functions is $\frac{b!}{(b/2)!}$
solution(2) ($a=2$ and $b$ even, we determine the number of possible functions)
we have $$f(n + bm) = f(n) + bm$$ for all $n,m\in\mathbb{N}$
Now take an arbitrary integer $p$, $\; 0 \leq b \leq k−1 $, and let $f(p) = bq+r$, where $q\in \mathbb{N}$ and $0 \leq r \leq b−1$. Then $p + b = f(f(p)) = f(bq + r) = f(r) + bq$. Hence either $q = 0$ or $q = 1$ and therefore either $f(p) = r$, $f(r) = p + b$ or $f(p) = r + b$, $f(r) = p$.
In both cases we have $p \neq r$ which shows that $f$ defines a pairing of the set $A =\{0,1,...,b\}$. Note that different functions define different pairings of $A$. Conversely, any pairing of $A$ defines a function $f$ with the previous propriety. Thus the number of the functions with the given property is equal to that of all pairings of the set $A$. It is easy to see that this number is equal to $$\frac{b!}{(b/2)!}$$
Question What is the number of possible functions if $a>2$? is there any chance that the number is $\frac{b!}{(b/a)!}$?
Yes your guess is correct.
From your link, we have that $f(n)-n$ is constant when $n$ varies over any congruence class modulo $b$, which implies $f(b+n)=b+f(n)$ for all $n$.
Let $n$ be a nonnegative integer and let $n=bq+r$ where $0\leq r <b$, then $f(n)=bq+f(r)$, so the function $f$ is determined by its action on $B=\{0,\ldots,b-1\}$. For $i\in B$, write $f(i)=bq_i + r_i$, where $q_i\in \mathbb{Z}$ and $0\leq r_i<b$.
Firstly, we have $q_i \geq 0$, since $f(i)\geq 0$.
Secondly, we claim that $q_i \leq 1$. Let $g(n)= \lfloor n/b \rfloor$. If $n=bq+r$, then $$ g(f(n)) =g(n)+q_r\geq g(n) $$ Also, $g(f^{(a)}(n))=g(n)+1$. Now if there exists $i\in B$ such that $q_i\geq 2$, then $$ 1=g(b+i)=g(f^{(a)}(i)) \geq g(f(i)) = g(i)+q_i \geq 2 $$ which is a contradiction.
Now let $x_0,x_1,x_2,\ldots$ be the remainders when $i,f(i),f^{(2)}(i),\ldots$ are divided by $b$, resp. We can easily see that $x_{j+a}=x_j$. We claim that all $x_0,\ldots,x_{a-1}$ are distinct. Supoose $x_s = x_{s+t}$ for some $s,t<a$. Letting $m=f^{(s)}(i)$, we have $f^{(t)}(m)=m+bq_0$ for some $q_0$. Then, $$ m+abq_0=f^{(at)}(m)=m+tb $$ so we have $q_0 = t/a$ which is a contradiction since RHS is not an integer.
Define $P(i)$ as the set $\{i=x_0,\ldots,x_{a-1}\}$ where $x_j$'s are defined as above. Since $P(x_j)=\{x_j,x_{j+1},\ldots,x_{j+a-1}\}=P(i)$, we can easily see that the $P(i)$'s partition $B$ when $i$ varies over $B$.
Since $1=g(f^{(a)}(i))=q_{x_0}+\ldots+q_{x_{a-1}}$, there is precisely one $q_{x_j}$ that equals 1. The rest equals 0. Pick that $x_j$ as the representative of $P(i)=P(x_j)$, and define an $a$-tuple $Q(i)=Q(x_j)$ as $(x_{j+1},x_{j+2},\ldots,x_{j+a}=x_j)$.
What we have done so far is, when there is an $f$ satisfying the problem, we can partition $B$ into tuples of size $a$, and for each tuple $(y_0,\ldots,y_{a-1})$, we have $$ f(y_0)=y_1,f(y_1)=y_2,\ldots f(y_{a-2})=y_{a-1}\\ f(y_{a-1})=b+y_a=b+y_0 $$ Also, for every partition of $B$ into $a$-tuples, and defining $f$ as above, we get a valid $f$ satisfying the problem. The number of partition of $B$ into $a$-tuples equals $b!/(b/a)!$.