Problem

Source: RMO 2024 Q2

Tags: number theory, Bounding



For a positive integer $n$, let $R(n)$ be the sum of the remainders when $n$ is divided by $1,2, \cdots , n$. For example, $R(4) = 0 + 0 + 1 + 0 = 1,$ $R(7) = 0 + 1 + 1 + 3 + 2 + 1 + 0 = 8$. Find all positive integers such that $R(n) = n-1$.