Problem

Source: IMO Shortlist 2007, C3, AIMO 2008, TST 2, P2

Tags: combinatorics, modular arithmetic, counting, IMO Shortlist, triplets, Hi



Find all positive integers $ n$ for which the numbers in the set $ S = \{1,2, \ldots,n \}$ can be colored red and blue, with the following condition being satisfied: The set $ S \times S \times S$ contains exactly $ 2007$ ordered triples $ \left(x, y, z\right)$ such that: (i) the numbers $ x$, $ y$, $ z$ are of the same color, and (ii) the number $ x + y + z$ is divisible by $ n$. Author: Gerhard Wöginger, Netherlands