Problem

Source: 2001 China National Olmpiad

Tags: modular arithmetic, limit, number theory proposed, number theory



Let $a=2001$. Consider the set $A$ of all pairs of integers $(m,n)$ with $n\neq0$ such that (i) $m<2a$; (ii) $2n|(2am-m^2+n^2)$; (iii) $n^2-m^2+2mn\leq2a(n-m)$. For $(m, n)\in A$, let \[f(m,n)=\frac{2am-m^2-mn}{n}.\] Determine the maximum and minimum values of $f$.