#!/bin/sh set -eu PROOF=${PROOF:-/app/proof.md} mkdir -p "$(dirname -- "$PROOF")" cat > "$PROOF" <<'IMO_PROOF_0ac40d9ab3f6c2a63b45c07c8a0b7ff5b5adde57e2e07d38a846709d2acb4742' Let $r$ be a positive real number. Let $A(r)$ denote the fractional part of $2r$, so $A(r) = 2r - \lfloor 2r \rfloor$. We are given that $B(n,r) = \sum_{k=1}^n A(kr)$. We want to find all positive real numbers $r$ such that $n(n+1)r - B(n,r)$ is a multiple of $n$ for all positive integers $n$. We can rewrite the condition as $$ n(n+1)r - \sum_{k=1}^n (2kr - \lfloor 2kr \rfloor) = \sum_{k=1}^n \lfloor 2kr \rfloor \quad \text{is a multiple of } n. $$ Let $\alpha = 2r$. Then the condition becomes: $\sum_{k=1}^n \lfloor k\alpha \rfloor$ is a multiple of $n$ for all positive integers $n$. We prove that all even integers $\alpha$ satisfy the condition, and no other real number $\alpha$ does so. First we will show that even integers satisfy the condition. If $\alpha=2m$ where $m$ is an integer then \[ \lfloor\alpha\rfloor+\lfloor2\alpha\rfloor+\cdots+\lfloor n\alpha\rfloor=2m+4m+\cdots+2mn=mn(n+1) \] which is a multiple of $n$. Since $r > 0$, we must have $\alpha = 2r > 0$. So $\alpha$ must be a positive even integer. If $\alpha = 2m$ for some positive integer $m$, then $r = m$, which is a positive integer. Now we will show that they are the only real numbers satisfying the conditions of the problem. Let $\alpha=k+\epsilon$ where $k$ is an integer and $0\leqslant\epsilon<1$. Then the number \[ \begin{aligned}\lfloor\alpha\rfloor+\lfloor2\alpha\rfloor+\cdots+\lfloor n\alpha\rfloor & = \lfloor k+\epsilon \rfloor+\lfloor2(k+\epsilon)\rfloor+\cdots+\lfloor n(k+\epsilon)\rfloor & = k+\lfloor\epsilon\rfloor+2k+\lfloor2\epsilon\rfloor+\cdots+nk+\lfloor n\epsilon\rfloor & =\frac{kn(n+1)}{2}+\lfloor\epsilon\rfloor+\lfloor2\epsilon\rfloor+\cdots+\lfloor n\epsilon\rfloor \end{aligned} \] has to be a multiple of $n$. We consider two cases based on the parity of $k$. \begin{itemize} \item Case 1: \textbf{$k$ is even.} Then $\frac{kn(n+1)}{2}$ is always a multiple of $n$. Thus \[ \lfloor\epsilon\rfloor+\lfloor2\epsilon\rfloor+\cdots+\lfloor n\epsilon\rfloor \] also has to be a multiple of $n$. We will prove that $\lfloor n\epsilon\rfloor=0$ for every positive integer $n$ by strong induction. The base case $n=1$ follows from the fact that $0\leqslant\epsilon<1$. Let us suppose that $\lfloor m\epsilon\rfloor=0$ for every $1\leqslant m 0$, $\alpha = 2r > 0$. So $\alpha$ must be a positive even integer. This means $2r = 2m$ for some positive integer $m$. Therefore, $r=m$ must be a positive integer. \item Case 2: \textbf{$k$ is odd.} We will prove that $\lfloor n\epsilon\rfloor=n-1$ for every natural number $n$ by strong induction. The base case $n=1$ again follows from the fact that $0\leqslant\epsilon<1$. Let us suppose that $\lfloor m\epsilon\rfloor=m-1$ for every $1\leqslant m