Problem

Source: BdMO National 2016

Tags: number theory, algebra, Bdmo, contests



Consider the set of integers $ \left \{ 1, 2, \dots , 100 \right \} $. Let $ \left \{ x_1, x_2, \dots , x_{100} \right \}$ be some arbitrary arrangement of the integers $ \left \{ 1, 2, \dots , 100 \right \}$, where all of the $x_i$ are different. Find the smallest possible value of the sum $$S = \left | x_2 - x_1 \right | + \left | x_3 - x_2 \right | + \cdots+ \left |x_{100} - x_{99} \right | + \left |x_1 - x_{100} \right | .$$