During AMC testing, the AoPS Wiki is in read-only mode. No edits can be made.

# Difference between revisions of "1998 USAMO Problems/Problem 1"

## Problem

Suppose that the set $\{1,2,\cdots, 1998\}$ has been partitioned into disjoint pairs $\{a_i,b_i\}$ ($1\leq i\leq 999$) so that for all $i$, $|a_i-b_i|$ equals $1$ or $6$. Prove that the sum $$|a_1-b_1|+|a_2-b_2|+\cdots +|a_{999}-b_{999}|$$ ends in the digit $9$.

## Solution

Notice that $|a_i - b_i| \equiv 1 \pmod 5$, so $S=|a_1-b_1|+|a_2-b_2|+\cdots +|a_{999}-b_{999}| \equiv 1+1+\cdots + 1 \equiv 999 \equiv 4 \bmod{5}$.

Also, for integers $M, N$ we have $|M-N| \equiv M-N \equiv M+N \bmod{2}$.

Thus, we also have $S \equiv a_1+b_1+a_2+b_2+\cdots +a_{999}+b_{999} \equiv 1+2+ \cdots +1998 \equiv 999*1999 \equiv 1 \bmod{2}$ also, so by the Chinese Remainder Theorem $S \equiv 9\bmod{10}$. Thus, $S$ ends in the digit 9, as desired.