๐Ÿงฎ Brain Teaser

Consecutive Subsum Divisible by nn

Problem

Let a1,a2,โ€ฆ,ana_1, a_2, \ldots, a_n be any nn integers. Prove that there exist indices 1โ‰คiโ‰คjโ‰คn1 \leq i \leq j \leq n such that

nโˆฃai+ai+1+โ‹ฏ+ajn \mid a_i + a_{i+1} + \cdots + a_j


Field

Putnam / Combinatorics / Number Theory

Why It's Beautiful

No matter what nn integers you choose โ€” positive, negative, huge, tiny โ€” you are guaranteed a consecutive block that sums to a multiple of nn. The result feels surprising because there are no restrictions on the integers at all.

The proof is a one-paragraph application of the Pigeonhole Principle on partial sums, which reduces a statement about consecutive blocks into a statement about remainders. It is a model of elegant combinatorial reasoning.

Key Idea / Trick

Consider the n+1n+1 partial sums S0=0,โ€‰S1=a1,โ€‰S2=a1+a2,โ€‰โ€ฆ,โ€‰Sn=a1+โ‹ฏ+anS_0 = 0,\, S_1 = a_1,\, S_2 = a_1+a_2,\, \ldots,\, S_n = a_1+\cdots+a_n.

There are n+1n+1 sums but only nn possible remainders mod nn, so by Pigeonhole, two partial sums must be congruent mod nn: say Siโ‰กSj(modn)S_i \equiv S_j \pmod{n} with i<ji < j.

Then ai+1+โ‹ฏ+aj=Sjโˆ’Siโ‰ก0(modn)a_{i+1} + \cdots + a_j = S_j - S_i \equiv 0 \pmod{n}.

Difficulty

2 / 5

Tags

Putnam, Pigeonhole principle, Partial sums, Divisibility, Modular arithmetic, Combinatorics

PigeonholePartial sumsDivisibilityModular arithmetic

Consecutive Subsum Divisible by nn โ€” Answer

Setup: Define Partial Sums

Define S0=0S_0 = 0 and Sk=a1+a2+โ‹ฏ+akS_k = a_1 + a_2 + \cdots + a_k for k=1,2,โ€ฆ,nk = 1, 2, \ldots, n.

This gives n+1n + 1 integers: S0,S1,โ€ฆ,SnS_0, S_1, \ldots, S_n.


Apply Pigeonhole

Each SkS_k has some remainder when divided by nn, taking values in {0,1,โ€ฆ,nโˆ’1}\{0, 1, \ldots, n-1\} โ€” only nn possible remainders.

We have n+1n+1 partial sums but only nn possible remainders, so by the Pigeonhole Principle, two must share the same remainder:

Siโ‰กSj(modn)forย someย 0โ‰คi<jโ‰คnS_i \equiv S_j \pmod{n} \quad \text{for some } 0 \leq i < j \leq n


Extract the Consecutive Subsum

ai+1+ai+2+โ‹ฏ+aj=Sjโˆ’Siโ‰ก0(modn)a_{i+1} + a_{i+2} + \cdots + a_j = S_j - S_i \equiv 0 \pmod{n}

So the consecutive block ai+1,โ€ฆ,aja_{i+1}, \ldots, a_j has sum divisible by nn. โ– \blacksquare


Example

Take n=4n = 4 and (a1,a2,a3,a4)=(3,1,4,2)(a_1, a_2, a_3, a_4) = (3, 1, 4, 2).

| kk | SkS_k | Skโ€Šmodโ€Š4S_k \bmod 4 | |-----|--------|----------------| | 0 | 0 | 0 | | 1 | 3 | 3 | | 2 | 4 | 0 | | 3 | 8 | 0 | | 4 | 10 | 2 |

S0โ‰กS2โ‰ก0S_0 \equiv S_2 \equiv 0, so a1+a2=3+1=4a_1 + a_2 = 3 + 1 = 4 is divisible by 4. โœ“

Also S2โ‰กS3S_2 \equiv S_3, so a3=4a_3 = 4 is divisible by 4. โœ“


Why S0=0S_0 = 0 Is Needed

Including S0=0S_0 = 0 is crucial: it handles the case where the subsum starts at a1a_1 (i.e., i=0i = 0). Without it, we'd only have nn partial sums S1,โ€ฆ,SnS_1, \ldots, S_n and Pigeonhole would give nothing.

It also captures the special case where nโˆฃSn=a1+โ‹ฏ+ann \mid S_n = a_1 + \cdots + a_n directly (when S0โ‰กSnS_0 \equiv S_n).


Remark: Sharpness

The bound nn integers is tight: with nโˆ’1n-1 integers you can fail. For example, with n=3n = 3 and (a1,a2)=(1,1)(a_1, a_2) = (1, 1): partial sums are 1,21, 2 โ€” neither is โ‰ก0\equiv 0 and no consecutive subsum is divisible by 3.