problem:
(a) Prove that every positive integer $n$ can be written uniquely in the form

$$
n=\sum_{j=1}^{2 k+1}(-1)^{j-1} 2^{m_{j}}
$$

where $k \geq 0$ and $0 \leq m_{1}<m_{2}<\cdots<m_{2 k+1}$ are integers.
This number $k$ is called the weight of $n$.
(b) Find (in closed form) the difference between the number of positive integers at most $2^{2017}$ with even weight and the number of positive integers at most $2^{2017}$ with odd weight.

## Vjekoslav Kovač, Croatia

solution:
(a) We show by induction on the integer $M \geq 0$ that every integer $n$ in the range $-2^{M}+1$ through $2^{M}$ can uniquely be written in the form $n=\sum_{j=1}^{\ell}(-1)^{j-1} 2^{m_{j}}$ for some integers $\ell \geq 0$ and $0 \leq m_{1}<m_{2}<\cdots<m_{\ell} \leq M$ (empty sums are 0 ); moreover, in this unique representation $\ell$ is odd if $n>0$, and even if $n \leq 0$. The integer $w(n)=\lfloor\ell / 2\rfloor$ is called the weight of $n$.

Existence once proved, uniqueness follows from the fact that there are as many such representations as integers in the range $-2^{M}+1$ through $2^{M}$, namely, $2^{M+1}$.

To prove existence, notice that the base case $M=0$ is clear, so let $M \geq 1$ and let $n$ be an integer in the range $-2^{M}+1$ through $2^{M}$.

If $-2^{M}+1 \leq n \leq-2^{M-1}$, then $1 \leq n+2^{M} \leq 2^{M-1}$, so $n+2^{M}=\sum_{j=1}^{2 k+1}(-1)^{j-1} 2^{m_{j}}$ for some integers $k \geq 0$ and $0 \leq m_{1}<\cdots<m_{2 k+1} \leq M-1$ by the induction hypothesis, and $n=\sum_{j=1}^{2 k+2}(-1)^{j-1} 2^{m_{j}}$, where $m_{2 k+2}=M$.

The case $-2^{M-1}+1 \leq n \leq 2^{M-1}$ is covered by the induction hypothesis.
Finally, if $2^{M-1}+1 \leq n \leq 2^{M}$, then $-2^{M-1}+1 \leq n-2^{M} \leq 0$, so $n-2^{M}=\sum_{j=1}^{2 k}(-1)^{j-1} 2^{m_{j}}$ for some integers $k \geq 0$ and $0 \leq m_{1}<\cdots<m_{2 k} \leq M-1$ by the induction hypothesis, and $n=\sum_{j=1}^{2 k+1}(-1)^{j-1} 2^{m_{j}}$, where $m_{2 k+1}=M$.
(b) First Approach. Let $M \geq 0$ be an integer. The solution for part (a) shows that the number of even (respectively, odd) weight integers in the range 1 through $2^{M}$ coincides with the number of subsets in $\{0,1,2, \ldots, M\}$ whose cardinality has remainder 1 (respectively, 3) modulo 4. Therefore, the difference of these numbers is

$$
\sum_{k=0}^{\lfloor M / 2\rfloor}(-1)^{k}\binom{M+1}{2 k+1}=\frac{(1+\mathrm{i})^{M+1}-(1-\mathrm{i})^{M+1}}{2 \mathrm{i}}=2^{(M+1) / 2} \sin \frac{(M+1) \pi}{4}
$$

where $\mathrm{i}=\sqrt{-1}$ is the imaginary unit. Thus, the required difference is $2^{1009}$.
Second Approach. For every integer $M \geq 0$, let $A_{M}=\sum_{n=-2^{M}+1}^{0}(-1)^{w(n)}$ and let $B_{M}=$ $\sum_{n=1}^{2^{M}}(-1)^{w(n)}$; thus, $B_{M}$ evaluates the difference of the number of even weight integers in the range 1 through $2^{M}$ and the number of odd weight integers in that range.

Notice that

$$
w(n)= \begin{cases}w\left(n+2^{M}\right)+1 & \text { if }-2^{M}+1 \leq n \leq-2^{M-1} \\ w\left(n-2^{M}\right) & \text { if } 2^{M-1}+1 \leq n \leq 2^{M}\end{cases}
$$

to get

$$
\begin{aligned}
& A_{M}=-\sum_{n=-2^{M}+1}^{-2^{M-1}}(-1)^{w\left(n+2^{M}\right)}+\sum_{n=-2^{M-1}+1}^{0}(-1)^{w(n)}=-B_{M-1}+A_{M-1}, \\
& B_{M}=\sum_{n=1}^{2^{M-1}}(-1)^{w(n)}+\sum_{n=2^{M-1}+1}^{2^{M}}(-1)^{w\left(n-2^{M}\right)}=B_{M-1}+A_{M-1} .
\end{aligned}
$$

Iteration yields

$$
\begin{aligned}
B_{M} & =A_{M-1}+B_{M-1}=\left(A_{M-2}-B_{M-2}\right)+\left(A_{M-2}+B_{M-2}\right)=2 A_{M-2} \\
& =2 A_{M-3}-2 B_{M-3}=2\left(A_{M-4}-B_{M-4}\right)-2\left(A_{M-4}+B_{M-4}\right)=-4 B_{M-4}
\end{aligned}
$$

Thus, $B_{2017}=(-4)^{504} B_{1}=2^{1008} B_{1}$; since $B_{1}=(-1)^{w(1)}+(-1)^{w(2)}=2$, it follows that $B_{2017}=$ $2^{1009}$ 。

problem_match: Problem 1.

solution_match: Solution.


problem:
Determine all positive integers $n$ satisfying the following condition: for every monic polynomial $P$ of degree at most $n$ with integer coefficients, there exists a positive integer $k \leq n$, and $k+1$ distinct integers $x_{1}, x_{2}, \ldots, x_{k+1}$ such that

$$
P\left(x_{1}\right)+P\left(x_{2}\right)+\cdots+P\left(x_{k}\right)=P\left(x_{k+1}\right)
$$

Semen Petrov, Russia
Note. A polynomial is monic if the coefficient of the highest power is one.

solution:
There is only one such integer, namely, $n=2$. In this case, if $P$ is a constant polynomial, the required condition is clearly satisfied; if $P=X+c$, then $P(c-1)+P(c+1)=$ $P(3 c)$; and if $P=X^{2}+q X+r$, then $P(X)=P(-X-q)$.

To rule out all other values of $n$, it is sufficient to exhibit a monic polynomial $P$ of degree at most $n$ with integer coefficients, whose restriction to the integers is injective, and $P(x) \equiv 1$ $(\bmod n)$ for all integers $x$. This is easily seen by reading the relation in the statement modulo $n$, to deduce that $k \equiv 1(\bmod n)$, so $k=1$, since $1 \leq k \leq n$; hence $P\left(x_{1}\right)=P\left(x_{2}\right)$ for some distinct integers $x_{1}$ and $x_{2}$, which contradicts injectivity.

If $n=1$, let $P=X$, and if $n=4$, let $P=X^{4}+7 X^{2}+4 X+1$. In the latter case, clearly, $P(x) \equiv 1(\bmod 4)$ for all integers $x$; and $P$ is injective on the integers, since $P(x)-P(y)=$ $(x-y)\left((x+y)\left(x^{2}+y^{2}+7\right)+4\right)$, and the absolute value of $(x+y)\left(x^{2}+y^{2}+7\right)$ is either 0 or at least 7 for integral $x$ and $y$.

Assume henceforth $n \geq 3, n \neq 4$, and let $f_{n}=(X-1)(X-2) \cdots(X-n)$. Clearly, $f_{n}(x) \equiv$ $0(\bmod n)$ for all integers $x$. If $n$ is odd, then $f_{n}$ is non-decreasing on the integers; and if, in addition, $n>3$, then $f_{n}(x) \equiv 0(\bmod n+1)$ for all integers $x$, since $f_{n}(0)=-n!=-1 \cdot 2 \cdot \ldots$. $\frac{n+1}{2} \cdots \cdot n \equiv 0(\bmod n+1)$.

Finally, let $P=f_{n}+n X+1$ if $n$ is odd, and let $P=f_{n-1}+n X+1$ if $n$ is even. In either case, $P$ is strictly increasing, hence injective, on the integers, and $P(x) \equiv 1(\bmod n)$ for all integers $x$.

Remark. The polynomial $P=f_{n}+n X+1$ works equally well for even $n>2$. To prove injectivity, notice that $P$ is strictly monotone, hence injective, on non-positive (respectively, positive) integers. Suppose, if possible, that $P(a)=P(b)$ for some integers $a \leq 0$ and $b>0$. Notice that $P(a) \geq P(0)=n!+1>n^{2}+1=P(n)$, since $n \geq 4$, to infer that $b \geq n+1$. It is therefore sufficient to show that $P(x)>P(n+1-x)>P(x-1)$ for all integers $x \geq n+1$. The former inequality is trivial, since $f_{n}(x)=f_{n}(n+1-x)$ for even $n$. For the latter, write

$$
\begin{aligned}
P(n+1-x)-P(x-1) & =(x-1) \cdots(x-n)-(x-2) \cdots(x-n-1)+n(n+2-2 x) \\
& =n((x-2) \cdots(x-n)+(n-2)-2(x-2)) \geq n(n-2)>0,
\end{aligned}
$$

since $(x-3) \cdots(x-n) \geq 2$.

problem_match: Problem 2.


problem:
Let $n$ be an integer greater than 1 and let $X$ be an $n$-element set. A non-empty collection of subsets $A_{1}, \ldots, A_{k}$ of $X$ is tight if the union $A_{1} \cup \cdots \cup A_{k}$ is a proper subset of $X$ and no element of $X$ lies in exactly one of the $A_{i}$ s. Find the largest cardinality of a collection of proper non-empty subsets of $X$, no non-empty subcollection of which is tight.

Note. A subset $A$ of $X$ is proper if $A \neq X$. The sets in a collection are assumed to be distinct. The whole collection is assumed to be a subcollection.

## Alexander Polyansky, Russia

solution:
. (Ilya Bogdanov) The required maximum is $2 n-2$. To describe a ( $2 n-2$ )-element collection satisfying the required conditions, write $X=\{1,2, \ldots, n\}$ and set $B_{k}=\{1,2, \ldots, k\}$, $k=1,2, \ldots, n-1$, and $B_{k}=\{k-n+2, k-n+3, \ldots, n\}, k=n, n+1, \ldots, 2 n-2$. To show that no subcollection of the $B_{k}$ is tight, consider a subcollection $\mathcal{C}$ whose union $U$ is a proper subset of $X$, let $m$ be an element in $X \backslash U$, and notice that $\mathcal{C}$ is a subcollection of $\left\{B_{1}, \ldots, B_{m-1}, B_{m+n-1}, \ldots, B_{2 n-2}\right\}$, since the other $B$ 's are precisely those containing $m$. If $U$ contains elements less than $m$, let $k$ be the greatest such and notice that $B_{k}$ is the only member of $\mathcal{C}$ containing $k$; and if $U$ contains elements greater than $m$, let $k$ be the least such and notice that $B_{k+n-2}$ is the only member of $\mathcal{C}$ containing $k$. Consequently, $\mathcal{C}$ is not tight.

We now proceed to show by induction on $n \geq 2$ that the cardinality of a collection of proper non-empty subsets of $X$, no subcollection of which is tight, does not exceed $2 n-2$. The base case $n=2$ is clear, so let $n>2$ and suppose, if possible, that $\mathcal{B}$ is a collection of $2 n-1$ proper non-empty subsets of $X$ containing no tight subcollection.

To begin, notice that $\mathcal{B}$ has an empty intersection: if the members of $\mathcal{B}$ shared an element $x$, then $\mathcal{B}^{\prime}=\{B \backslash\{x\}: B \in \mathcal{B}, B \neq\{x\}\}$ would be a collection of at least $2 n-2$ proper non-empty subsets of $X \backslash\{x\}$ containing no tight subcollection, and the induction hypothesis would be contradicted.

Now, for every $x$ in $X$, let $\mathcal{B}_{x}$ be the (non-empty) collection of all members of $\mathcal{B}$ not containing $x$. Since no subcollection of $\mathcal{B}$ is tight, $\mathcal{B}_{x}$ is not tight, and since the union of $\mathcal{B}_{x}$ does not contain $x$, some $x^{\prime}$ in $X$ is covered by a single member of $\mathcal{B}_{x}$. In other words, there is a single set in $\mathcal{B}$ covering $x^{\prime}$ but not $x$. In this case, draw an arrow from $x$ to $x^{\prime}$. Since there is at least one arrow from each $x$ in $X$, some of these arrows form a (minimal) cycle $x_{1} \rightarrow x_{2} \rightarrow \cdots \rightarrow x_{k} \rightarrow x_{k+1}=x_{1}$ for some suitable integer $k \geq 2$. Let $A_{i}$ be the unique member of $\mathcal{B}$ containing $x_{i+1}$ but not $x_{i}$, and let $X^{\prime}=\left\{x_{1}, x_{2}, \ldots, x_{k}\right\}$.

Remove $A_{1}, A_{2}, \ldots, A_{k}$ from $\mathcal{B}$ to obtain a collection $\mathcal{B}^{\prime}$ each member of which either contains or is disjoint from $X^{\prime}$ : for if a member $B$ of $\mathcal{B}^{\prime}$ contained some but not all elements of $X^{\prime}$, then $B$ should contain $x_{i+1}$ but not $x_{i}$ for some $i$, and $B=A_{i}$, a contradiction. This rules out the case $k=n$, for otherwise $\mathcal{B}=\left\{A_{1}, A_{2}, \ldots, A_{n}\right\}$, so $|\mathcal{B}|<2 n-1$.

To rule out the case $k<n$, consider an extra element $x^{*}$ outside $X$ and let

$$
\mathcal{B}^{*}=\left\{B: B \in \mathcal{B}^{\prime}, B \cap X^{\prime}=\varnothing\right\} \cup\left\{\left(B \backslash X^{\prime}\right) \cup\left\{x^{*}\right\}: B \in \mathcal{B}^{\prime}, X^{\prime} \subseteq B\right\} ;
$$

thus, in each member of $\mathcal{B}^{\prime}$ containing $X^{\prime}$, the latter is collapsed to singleton $x^{*}$. Notice that $\mathcal{B}^{*}$ is a collection of proper non-empty subsets of $X^{*}=\left(X \backslash X^{\prime}\right) \cup\left\{x^{*}\right\}$, no subcollection of which is tight. By the induction hypothesis, $\left|\mathcal{B}^{\prime}\right|=\left|\mathcal{B}^{*}\right| \leq 2\left|X^{*}\right|-2=2(n-k)$, so $|\mathcal{B}| \leq 2(n-k)+k=$ $2 n-k<2 n-1$, a final contradiction.

problem_match: Problem 3.

solution_match: Solution 1


solution:
. Proceed again by induction on $n$ to show that the cardinality of a collection of proper non-empty subsets of $X$, no subcollection of which is tight, does not exceed $2 n-2$.

Consider any collection $\mathcal{B}$ of proper non-empty subsets of $X$ with no tight subcollection (we call such collection good). Assume that there exist $M, N \in \mathcal{B}$ such that $M \cup N$ is distinct from $M, N$, and $X$. In this case, we will show how to modify $\mathcal{B}$ so that it remains good, contains the same number of sets, but the total number of elements in the sets of $\mathcal{B}$ increases.

Consider a maximal (relative to set-theoretic inclusion) subcollection $\mathcal{C} \subseteq \mathcal{B}$ such that the set $C=\bigcup_{A \in \mathcal{C}} A$ is distinct from $X$ and from all members of $\mathcal{C}$. Notice here that the union of any subcollection $\mathcal{D} \subset \mathcal{B}$ cannot coincide with any $K \in \mathcal{B} \backslash \mathcal{D}$, otherwise $\{K\} \cup \mathcal{D}$ would be tight. Surely, $\mathcal{C}$ exists (since $\{M, N\}$ is an example of a collection satisfying the requirements on $\mathcal{C}$, except for maximality); moreover, $C \notin \mathcal{B}$ by the above remark.

Since $C \neq X$, there exists an $L \in \mathcal{C}$ and $x \in L$ such that $L$ is the unique set in $\mathcal{C}$ containing $x$. Now replace in $\mathcal{B}$ the set $L$ by $C$ in order to obtain a new collection $\mathcal{B}^{\prime}$ (then $\left.\left|\mathcal{B}^{\prime}\right|=|\mathcal{B}|\right)$. We claim that $\mathcal{B}^{\prime}$ is good.

Assume, to the contrary, that $\mathcal{B}^{\prime}$ contained a tight subcollection $\mathcal{T}$; clearly, $C \in \mathcal{T}$, otherwise $\mathcal{B}$ is not good. If $\mathcal{T} \subseteq \mathcal{C} \cup\{C\}$, then $C$ is the unique set in $\mathcal{T}$ containing $x$ which is impossible. Therefore, there exists $P \in \mathcal{T} \backslash(\mathcal{C} \cup\{C\})$. By maximality of $\mathcal{C}$, the collection $\mathcal{C} \cup\{P\}$ does not satisfy the requirements imposed on $\mathcal{C}$; since $P \cup C \neq X$, this may happen only if $C \cup P=P$, i.e., if $C \subset P$. But then $\mathcal{G}=(\mathcal{T} \backslash\{C\}) \cup \mathcal{C}$ is a tight subcollection in $\mathcal{B}$ : all elements of $C$ are covered by $\mathcal{G}$ at least twice (by $P$ and an element of $\mathcal{C}$ ), and all the rest elements are covered by $\mathcal{G}$ the same number of times as by $\mathcal{T}$. A contradiction. Thus $\mathcal{B}^{\prime}$ is good.

Such modifications may be performed finitely many times, since the total number of elements of sets in $\mathcal{B}$ increases. Thus, at some moment we arrive at a good collection $\mathcal{B}$ for which the procedure no longer applies. This means that for every $M, N \in \mathcal{B}$, either $M \cup N=X$ or one of them is contained in the other.

Now let $M$ be a minimal (with respect to inclusion) set in $\mathcal{B}$. Then each set in $\mathcal{B}$ either contains $M$ or forms $X$ in union with $M$ (i.e., contains $X \backslash M$ ). Now one may easily see that the two collections

$$
\mathcal{B}_{+}=\{A \backslash M: A \in \mathcal{B}, M \subset A, A \neq M\}, \quad \mathcal{B}_{-}=\{A \cap M: A \in \mathcal{B}, X \backslash M \subset A, A \neq X \backslash M\}
$$

are good as collections of subsets of $X \backslash M$ and $M$, respectively; thus, by the induction hypothesis, we have $\left|\mathcal{B}_{+}\right|+\left|\mathcal{B}_{-}\right| \leq 2 n-4$.

Finally, each set $A \in \mathcal{B}$ either produces a set in one of the two new collections, or coincides with $M$ or $X \backslash M$. Thus $|\mathcal{B}| \leq\left|\mathcal{B}_{+}\right|+\left|\mathcal{B}_{-}\right|+2 \leq 2 n-2$, as required.

solution_match: Solution 2


solution:
. We provide yet another proof of the estimate $|\mathcal{B}| \leq 2 n-2$, using the notion of a good collection from Solution 2. Arguing indirectly, we assume that there exists a good collection $\mathcal{B}$ with $|\mathcal{B}| \geq 2 n-1$, and choose one such for the minimal possible value of $n$. Clearly, $n>2$.

Firstly, we perform a different modification of $\mathcal{B}$. Choose any $x \in X$, and consider the subcollection $\mathcal{B}_{x}=\{B: B \in \mathcal{B}, x \notin B\}$. By our assumption, $\mathcal{B}_{x}$ is not tight. As the union of sets in $\mathcal{B}_{x}$ is distinct from $X$, either this collection is empty, or there exists an element $y \in X$ contained in a unique member $A_{x}$ of $\mathcal{B}_{x}$. In the former case, we add the set $B_{x}=X \backslash\{x\}$ to $\mathcal{B}$, and in the latter we replace $A_{x}$ by $B_{x}$, to form a new collection $\mathcal{B}^{\prime}$. (Notice that if $B_{x} \in \mathcal{B}$, then $B_{x} \in \mathcal{B}_{x}$ and $y \in B_{x}$, so $B_{x}=A_{x}$.)

We claim that the collection $\mathcal{B}^{\prime}$ is also good. Indeed, if $\mathcal{B}^{\prime}$ has a tight subcollection $\mathcal{T}$, then $B_{x}$ should lie in $\mathcal{T}$. Then, as the union of the sets in $\mathcal{T}$ is distinct from $X$, we should have $\mathcal{T} \subseteq \mathcal{B}_{x} \cup\left\{B_{x}\right\}$. But in this case an element $y$ is contained in a unique member of $\mathcal{T}$, namely $B_{x}$, so $\mathcal{T}$ is not tight - a contradiction.

Perform this procedure for every $x \in X$, to get a good collection $\mathcal{B}$ containing the sets $B_{x}=X \backslash\{x\}$ for all $x \in X$. Consider now an element $x \in X$ such that $\left|\mathcal{B}_{x}\right|$ is maximal. As we have mentioned before, there exists an element $y \in X$ belonging to a unique member (namely, $B_{x}$ ) of $\mathcal{B}_{x}$. Thus, $\mathcal{B}_{x} \backslash\left\{B_{x}\right\} \subset \mathcal{B}_{y}$; also, $B_{y} \in \mathcal{B}_{y} \backslash \mathcal{B}_{x}$. Thus we get $\left|\mathcal{B}_{y}\right| \geq\left|\mathcal{B}_{x}\right|$, which by the maximality assumption yields the equality, which in turn means that $\mathcal{B}_{y}=\left(\mathcal{B}_{x} \backslash\left\{B_{x}\right\}\right) \cup\left\{B_{y}\right\}$.

Therefore, each set in $\mathcal{B} \backslash\left\{B_{x}, B_{y}\right\}$ contains either both $x$ and $y$, or none of them. Collapsing $\{x, y\}$ to singleton $x^{*}$, we get a new collection of $|\mathcal{B}|-2$ subsets of $(X \backslash\{x, y\}) \cup\left\{x^{*}\right\}$ containing no tight subcollection. This contradicts minimality of $n$.

Remarks. 1. Removal of the condition that subsets be proper would only increase the maximum by 1. The 'non-emptiness' condition could also be omitted, since the empty set forms a tight collection by itself, but the argument is a bit too formal to be considered.
2. There are many different examples of good collections of $2 n-2$ sets. E.g., applying the algorithm from the first part of Solution 2 to the example shown in Solution 1, one may get the following example: $B_{k}=\{1,2, \ldots, k\}, k=1,2, \ldots, n-1$, and $B_{k}=X \backslash\{k-n+1\}$, $k=n, n+1, \ldots, 2 n-2$.

solution_match: Solution 3