## Task A-4.7.

Višnja decided to write all natural numbers from 1 to 2014 in some order on the board. Višnja's brother Marijan will write the absolute value of the difference between each pair of adjacent numbers, and then erase all the original numbers. Marijan will repeat this process until only one number remains on the board.

Determine the largest possible number that can remain on the board at the end.
## Solution.

Notice that the largest number on the board cannot increase in any step, because for non-negative numbers $x$ and $y$ we have

$$
|x-y| \leqslant \max \{x, y\}
$$

Since the numbers $1, 2, \ldots, 2014$ are initially written on the board, after the first step, the largest possible number on the board is 2013, and the smallest possible is 1.

This means that after the second step, the largest possible number on the board is 2012, so the number that remains at the end cannot be greater than 2012.

We claim that the largest number that can remain on the board is 2012.

We still need to show that this can actually happen.

If Višnja initially writes the numbers in the following order:

$$
2014, 1, 2, 3, \ldots, 2012, 2013.
$$

Then after the first step, the numbers on the board are:

$$
2013, \quad 1, \quad 1, \ldots, \quad 1, 1
$$

and after the second step:

$$
2012, \quad 0, \quad 0, \ldots, \quad 0
$$

In each subsequent step, there is one fewer zero, until only the number 2012 remains on the board.