Find all functions $f : \mathbb{N} \to \mathbb{N}$ satisfying the following conditions: For every $n \in \mathbb{N}$, $f^{(n)}(n) = n$. (Here $f^{(1)} = f$ and $f^{(k)} = f^{(k-1)} \circ f$.) For every $m, n \in \mathbb{N}$, $\lvert f(mn) - f(m) f(n) \rvert < 2017$.
Problem
Source: 2017 Korea Winter Program Practice Test 1 Day 2 #2
Tags: function, number theory
23.01.2017 16:09
The second condition implies that $ f(mn)=f(m)f(n) $ by itself if there are big $ f(k) $s And the fact that $ p|f(p) $ kills it.
23.01.2017 16:20
@above Can you elaborate why $f(mn)=f(m)f(n)$ please,
23.01.2017 16:56
First it is easy that there is big $ f(k) $. Then, $ f(k)|f(mn)-f(m)f(n)|= |f(mn)f(k)-f(m)f(n)f(k)| \leq |f(mnk)-f(m)f(k)f(n)|+|f(mnk)-f(mn)f(k)| \leq f(m)|f(nk)-f(n)f(k)|+|f(mnk)-f(m)f(nk)|+|f(mnk)-f(mn)f(k)| \leq 2017f(m)+2017+2017 $ so, $ f(mn)=f(m)f(n) $
23.01.2017 17:12
To finish, note that either $f(p) = p$ or $f(p)$ lives in a chain of length $p$ where the chain is formed by considering $\{ p,f(p),\cdots,f^{p-1}(p) \}$ since the length of the chain must divide $p$. Now since $f^{p-1} (p)$ lives in a chain of length $p$, it follows that $p$ divides it so $f^{p-1}(p) = kp$ for some $k$. Then $f(kp) = p$ but $f(kp) = kf(p) \geq f(p) > p$ since $f(p)$ is a multiple of $p$. Hence $f(p) = p$ for all primes $p$ and $f(n) = n$ from $f$ being multiplicative.
23.01.2017 19:37
I'd like to give an idea-based presentation of the finish of the solution. (I feel it's quite clear that the purpose of this whole problem is to be educational.) We use condition $(*)$ $f^{n}(n)=n$ and three ideas: We looked at orbits. We can assign each $n$ its orbit $O_n=\{n\to f(n)\to f(f(n))\to\dots\}$. By $(*)$, $O_n$ is a finite cycle. By looking at the values of the sequence $n,f(n),\dots,f^k(n),\dots$, it's obvious that $f^k(n)=n$ if and only if $|O_n|$ divides $k$. So $(*)$ is equivalent to $|O_n|$ dividing $n$. We used the 'plug in f(x)' trick. Since $|O_p|=p$, either $O_p=\{p\}$, or $|O_p|=p$. In the latter case, by $(*)$, $x\in O_p$ implies $O_p=O_x$, so $p|x$. Thus, $p|f^{p-1}(p)$ yields the contradiction $f(p)\neq p$, but $p\,|\,f(p)\,|\,f(f^{p-1}(p))=p$. By multiplicativity, $f(n)$ decomposes into $f(p_1)^{\alpha_1}\dots f(p_r)^{\alpha_r}$ for $n=p_1^{\alpha_1}\dots p_r^{\alpha_r}$. Thus, $f(p)=p$ for primes implies $f(n)=n$ $\forall n\in\mathbb{N}$.
24.01.2017 21:11
The above posters have explained the idea very neatly; nevertheless I would like to compress the solution in a single post It should be noted that the second condition talks in terms of arithmetic structures like divisibility and also gives us an "obvious" but very useful quantitative estimate. The first condition is more "structure-oriented" telling us how $f$ behaves when applied many times. The tricky step is to establish multiplicativity from the second condition alone. Fix $n \ge 1$ such that for some $m$ we have $f(mn) \ne f(m)f(n)$. Note that $$f(k) \mid |f(mn)f(k)-f(m)f(n)f(k)| \Longrightarrow f(k) \le |f(mn)f(k)-f(m)f(n)f(k)| \le |f(mnk)-f(m)f(n)f(k)|+|f(mnk)-f(mn)f(k)|$$and $$|f(mnk)-f(m)f(n)f(k)| \le |f(mnk)-f(mk)f(n)|+|f(mk)f(n)-f(m)f(n)f(k)|$$so we conclude that $$f(k) \le 2017\cdot \left(2+f(n)\right).$$Since $f$ is surjective (from the first condition), it cannot be bounded above; a contradiction! Injectivity follows since $$f(a)=f(b)=c \Longrightarrow a=f^c(a)=f^c(b)=b.$$For prime $p$, applying the famous "plug in $f(x)$ again" trick we get $$f^{1+f(p)}(p)=f(p) \Longrightarrow f^{f(p)}(p)=p.$$Taking the order $d$ of $p$ under composition of $f$ we obtain $d \mid \gcd (p, f(p))$. If $d=1$ then $f(p)=p$ and otherwise we have $p \mid f(p)$. The latter holds in both the cases. From multiplicativity, we conclude that $n \mid f(n)$. In particular, we have $f(p) \mid f^p(p)=p$ and so $f(p)=p,$ following which we obtain $f(n)=n$ for all naturals $n$. In order to not lose a point, we'd like to mention that this is the only solution and it indeed works. $\, \square$ It was wonderful to see so many different ideas placed together. Nice problem!
09.11.2017 13:34
Any other solutions
16.09.2022 16:12
So we may just consider primes $p.$ We claim that $f(p)=p.$ Notice that the sequence $S_p=\{p,f(p),f(f(p)),\dots\}$ is finite and moreover, $|S_p|\mid p.$ So $|S_p|\in \{1,p\}.$ If, $|S_p|=1$ then done. Else, we have $S_p=S_{f(p)}$ which means $p\mid f(p).$ But then $f(p)\mid f^p(p)=p$, and so done.