4. Determine the largest natural number $n$ such that $n^{2}+2002 n$ is a perfect square of some natural number.
Solution. Let $n^{2}+2002 n=a^{2}, a \in \mathbb{N}$. Then $a=n+k$ for some $k \in \mathbb{N}$, so

$$
\begin{aligned}
& n^{2}+2002 n=(n+k)^{2} \\
& 2002 n-2 n k=k^{2} \\
& n=\frac{k^{2}}{2002-2 k}=\frac{k^{2}}{2(1001-k)}
\end{aligned}
$$

From the last equality, it follows that $k=2 m$ for some $m \in \mathbb{N}$, which means $n=\frac{2 m^{2}}{1001-2 m}$. Clearly, $1001-2 m>0$, so $m \leq 500$. Now, the largest natural number $n$ is obtained when in $n=\frac{2 m^{2}}{1001-2 m}$ we have the largest numerator and the smallest denominator, which is for $m=500$. Finally, the desired number is $n=\frac{2 \cdot 500^{2}}{1001-2 \cdot 500}=500000$.