Let $n$ be a positive integer. For each partition of the set $\{1,2,\dots,3n\}$ into arithmetic progressions, we consider the sum $S$ of the respective common differences of these arithmetic progressions. What is the maximal value that $S$ can attain? (An arithmetic progression is a set of the form $\{a,a+d,\dots,a+kd\}$, where $a,d,k$ are positive integers, and $k\geqslant 2$; thus an arithmetic progression has at least three elements, and successive elements have difference $d$, called the common difference of the arithmetic progression.)
Problem
Source: Benelux Mathematical Olympiad 2015, Problem 4
Tags: combinatorics, arithmetic sequence