Problem

Source: 8th European Mathematical Cup, Junior Category, Q1

Tags: number theory, combinatorics



Every positive integer is marked with a number from the set $\{ 0,1,2\}$, according to the following rule: $$\text{if a positive integer }k\text{ is marked with }j,\text{ then the integer }k+j\text{ is marked with }0.$$Let $S$ denote the sum of marks of the first $2019$ positive integers. Determine the maximum possible value of $S$. Proposed by Ivan Novak