Find all functions \( f : \mathbb{N} \to \mathbb{N} \) that satisfy the following condition: for any positive integers \( m \) and \( n \) such that \( m > n \) and \( m \) is not divisible by \( n \), if we denote by \( r \) the remainder of the division of \( m \) by \( n \), then the remainder of the division of \( f(m) \) by \( n \) is \( f(r) \). Proposed by Mykyta Kharin
Problem
Source: Kyiv City MO 2025 Round 1, Problem 10.4
Tags: number theory, functional equation
20.01.2025 10:10
MS_Kekas wrote: Find all functions \( f : \mathbb{N} \to \mathbb{N} \) that satisfy the following condition: for any positive integers \( m \) and \( n \) such that \( m > n \) and \( m \) is not divisible by \( n \), if we denote by \( r \) the remainder of the division of \( m \) by \( n \), then the remainder of the division of \( f(m) \) by \( n \) is \( f(r) \). 1) $f(x)\le x$ $\forall x\ge 1$
2) $\forall x\ge 1$, either $f(x)=1$, either $f(x)=x$
3) If $f(x)=1$ for some $x>1$, then $\boxed{\text{S1 : }f(x)=1\quad\forall x\in\mathbb Z_{>0}}$
4) If $f(x)\ne 1$ $\forall x>1$, then $\boxed{\text{S2 : }f(x)=x\quad\forall x\in\mathbb Z_{>0}}$