4. The general term of the sequence $101,104,109,116, \cdots$ is $a_{n}=100+n^{2}$, for each $n, d_{n}$ represents the greatest common divisor of $a_{n}$ and $a_{n+1}$, find the maximum value of $d_{n}$.
4. Solution: Let $d_{n}=\left(100+n^{2}, 100+(n+1)^{2}\right)$.

Then we have $d_{n}\left|\left(100+n^{2}\right), d_{n}\right|\left(100+(n+1)^{2}\right)$,
so $d_{n} \mid\left(100+(n+1)^{2}-100-n^{2}\right)$,
which means $d_{n} \mid(2 n+1)$.
Also, since $2\left(100+n^{2}\right)=n(2 n+1)+200-n$,
we have $d_{n}\left|(200-n), d_{n}\right|((2 n+1)+2(200-n))$,
which means $d_{n} \mid 401$,
so $1 \leqslant d_{n} \leqslant 401$.
Furthermore, when $n=200$, we have $100+n^{2}=100+200^{2}=100 \cdot 401$, $100+(n+1)^{2}=100+201^{2}=101 \cdot 401$,
so $d_{n}$ can reach 401.
Thus, $\left(d_{n}\right)_{\max }=401$.