Problem

Source: 2022 Chinese Girls' Mathematical Olympiad Day 2 Problem 6

Tags: number theory



Find all integers $n$ satisfying the following property. There exist nonempty finite integer sets $A$ and $B$ such that for any integer $m$, exactly one of these three statements below is true: (a) There is $a \in A$ such that $m \equiv a \pmod n$, (b) There is $b \in B$ such that $m \equiv b \pmod n$, and (c) There are $a \in A$ and $b \in B$ such that $m \equiv a + b \pmod n$.