Let $S = \{1, 2, \cdots , n\}, n \in N$. Find the number of functions $f : S \to S$ with the property that $x + f(f(f(f(x)))) = n + 1$ for all $x \in S$?
Problem
Source: Czech-Polish-Slovak 2002 Q3
Tags: function, algebra unsolved, algebra
28.04.2013 21:34
We have $f^{(8)}(x)=x$, and for $x\neq \frac{n+1}{2}$, $f^{(i)}(x)\neq x$ for $1\leq x\leq 7$. This is because if $i$ is the minimum such that $f^{(i)}(x)=x$, then $i|8$, but $i\not|4$ because $x\neq f^{(4)}(x)$. So every number except maybe 1 has period $8$. Hence, if $n\neq 8k$ or $8k+1$, then there are zero. Assume that $n=8k$. (If $n=8k+1$ then clearly $f\left(\frac{n+1}{2}\right)$ must equal $\frac{n+1}{2}$ because it's the only number with period less than 8, and so we are reduced to $8k$.) Let us divide up the sets $\{1, n\}, \{2, n-1\}, \{3, n-2\}, \ldots$ into groups of 4. We can do this in $\frac{\binom{4k}{4}\cdot\binom{4k-4}{4}\cdot\ldots\cdot\binom{4}{4}}{k!}=\frac{(4k)!}{(4!)^kk!}$ ways. Now in each quadruple of sets, we need to align the 8 numbers in cyclic order so that the numbers 4 apart are in the same set. We can do this by choosing the cyclic order of the 4 sets, in $3!=6$ ways, then given one of the numbers in one of the sets, which numbers in the sets in cyclic order are obtained by applying the function 3 times, which is $2^3=8$ ways. So this gives a total of $48$ ways to align the sets into a cycle $(i, f(i), f(f(i)), f(f(f(i))), n+1-i, n+1-f(i), n+1-f(f(i)), n+1-f(f(f(i))))$. For all $k$ octets this number is $48$. So the total number of functions we're looking for is $\frac{(4k)!(48)^k}{(24)^kk!}=\frac{(4k)!\cdot2^k}{k!}$. Thus the answer is $\frac{(4k)!\cdot2^k}{k!}$ if $n=8k$ or $8k+1$, and 0 otherwise.