Solution (source code)

= Solution

Consider the $N+1$ <fractional part>[fractional parts]
$$
\{0\alpha\},\{\alpha\},\ldots,\{N\alpha\}
$$
in $[0,1)$. Divide that interval into $N$ intervals of length $1/N$. By the <pigeonhole principle>, two fractional parts, say those indexed by $i<j$, lie in the same interval. Thus, for some <integer> $p$,
$$
|(j-i)\alpha-p|\leq\frac1N.
$$
Set $q=j-i$. Then $1\leq q\leq N$, and division by $q$ gives the <Dirichlet approximation theorem>
$$
\left|\alpha-\frac pq\right|\leq\frac1{qN}.
$$