Find the largest $k$ for which there exists a permutation $(a_1, a_2, \ldots, a_{2022})$ of integers from $1$ to $2022$ such that for at least $k$ distinct $i$ with $1 \le i \le 2022$ the number $\frac{a_1 + a_2 + \ldots + a_i}{1 + 2 + \ldots + i}$ is an integer larger than $1$. (Proposed by Oleksii Masalitin)
Problem
Source: Kyiv City MO 2022 Round 2, Problem 11.3
Tags: number theory, permutations, algebra
blawho12
30.01.2022 23:53
$k = 1011$
Let $b_i = \frac{a_1 + a_2 + \ldots + a_i}{1 + 2 + \ldots + i}$.
Now, note that $k = 1011$ is achievable by letting $a_i = 2i~~\forall i \leq 1011$ and completing the permutation in any way. This will have $b_i = 2$ for $i \leq 1011$.
It remains to show the upper bound. I claim that at most 1 $i \geq 1011$ can have $b_i$ be an integer larger than 1.
First note that $b_i \leq \frac{n + (n-1) + \ldots + (n-i+1)}{1 + 2 + \ldots + i} = \frac{n + n - i + 1}{1 + i} \leq \frac{3034}{1012} < 3$ for $i \geq 1011$, so the only possible value of $b_i$ is 2.
Now note that if $b_i \leq 2$ then $b_{i+1} < 2$. We can see this because $\frac{a_{i+1}}{i+1} \leq \frac{2022}{i+1} \leq \frac{2022}{1012} < 2$ and as $b_{i+1}$ is the mediant of $b_i$ and $\frac{a_{i+1}}{i+1}$ this implies $b_{i+1} < 2$. This means that if $b_i = 2$ for any $i \geq 1011$ then all further $b_j, j > i$ will be less than $2$ and cannot be integers.
Thus the maximum number of $b_i$ that are integers larger than $1$, is the first $1010$ and at most $1$ from the remaining terms. Thus $k \leq 1011$ as desired.