Problem

Source: Croatia 1998 4th Grade P3

Tags: combinatorics, fe, functional equation



Let $A=\{1,2,\ldots,2n\}$ and let the function $g:A\to A$ be defined by $g(k)=2n-k+1$. Does there exist a function $f:A\to A$ such that $f(k)\ne g(k)$ and $f(f(f(k)))=g(k)$ for all $k\in A$, if (a) $n=999$; (b) $n=1000$?