rec.puzzles Archive

Prove that all sets of n integers contain a subset whose sum is divisible by n.

arithmetic/subset

Problem

Prove that all sets of n integers contain a subset whose sum is divisible by n.
Show solution
Consider the set of remainders of the partial sums a(1) + ... + a(i).
Since there are n such sums, either one has remainder zero (and we're
thru) or 2 coincide, say the i'th and j'th.  In this case, a(i+1) +
... + a(j) is divisible by n.  (note this is a stronger result since
the subsequence constructed is of *adjacent* terms.)  Consider a(1)
(mod n), a(1)+a(2) (mod n), ..., a(1)+...+a(n) (mod n).  Either at
some point we have a(1)+...+a(m) = 0 (mod n) or else by the pigeonhole
principle some value (mod n) will have been duplicated.  We win either
way.