For $n$ distinct positive integers all their $n(n-1)/2$ pairwise sums are considered. For each of these sums Ivan has written on the board the number of original integers which are less than that sum and divide it. What is the maximum possible sum of the numbers written by Ivan?
Problem
Source: Tuymaada 2021/J3
Tags: number theory
31.07.2021 07:42
We claim that the answer is $\frac{(n-1)n(n+1)}{6}$. We prove this by induction. For $n=2$, the claim is obvious, since if the two numbers are $a_1 < a_2$, then we have $a_2 < a_1+a_2 < 2a_2$, which means that $a_2$ cannot divide the sum. Suppose the statement is true for some $n > 2$. Order the numbers $a_1 < a_2 < \cdots < a_{n+1}$. Using the inductive hypothesis on the first $n$ numbers, the sum of the numbers written on the board corresponding to their sums is at most $\frac{(n-1)n(n+1)}{6}$. Consider the quantities $a_{n+1}+a_i$. For each index $i$, we note that $a_i$ divides at most $k+1-i$ of these quantities, because if $a_i$ divides $a_{n+1}+a_\ell$ and $a_{n+1}+a_m$ for $\ell,m \leq i$, it also divides the difference $a_\ell-a_m$, a contradiction since $a_\ell-a_m < a_i$. For the pairs such that $a_{n+1}|a_i+a_j$, we note that $a_i+a_j < 2a_{n+1}$, and this means that $a_i+a_j=a_n$ which we ignore. Thus, for each quantity $a_{n+1}+a_i$, a number at most $n+1-i$ is written on the board. This increases the total by at most $$\sum_{i=1}^n (n+1-i)=\frac{n(n+1)}{2}$$Thus, the total is at most $$\frac{(n-1)n(n+1)}{6}+\frac{n(n+1)}{2}=\frac{n(n+1)(n+2)}{6}$$and we are done. For the construction, just take the numbers $2^1,\cdots,2^{n-1},2^n$. We note that for $i<j$, we have $2^k|2^i+2^j$ only for $k \leq i$. This makes equality hold in the above proof.