Problem

Source: Kyiv City MO 2025 Round 1, Problem 10.4

Tags: number theory, functional equation



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