4A. Let $f(n)=\frac{4 n+\sqrt{4 n^{2}-1}}{\sqrt{2 n-1}+\sqrt{2 n+1}}$, where $n \in \mathbb{N}$. Calculate the value of the expression $f(1)+f(2)+\ldots+f(40)$.
Solution. Let $2 n-1=a$ and $2 n+1=b$. Then $4 n=a+b$ and $4 n^{2}-1=a b$.

$$
\frac{4 n+\sqrt{4 n^{2}-1}}{\sqrt{2 n-1}+\sqrt{2 n+1}}=\frac{a+b+\sqrt{a b}}{\sqrt{a}+\sqrt{b}}=\frac{a+b+\sqrt{a b}}{\sqrt{a}+\sqrt{b}} \cdot \frac{\sqrt{a}-\sqrt{b}}{\sqrt{a}-\sqrt{b}}=\frac{(\sqrt{a})^{3}-(\sqrt{b})^{3}}{a-b} .
$$

From there,

$$
\frac{(\sqrt{a})^{3}-(\sqrt{b})^{3}}{a-b}=\frac{a \sqrt{a}-b \sqrt{b}}{a-b}=\frac{(2 n+1) \sqrt{2 n+1}-(2 n-1) \sqrt{2 n-1}}{2}
$$

Then:

$$
\begin{aligned}
f(1)+f(2)+\ldots+f(40) & =\frac{1}{2}((3 \sqrt{3}-1)+(5 \sqrt{5}-3 \sqrt{3})+\ldots+(81 \sqrt{81}-79 \sqrt{79})) \\
& =\frac{1}{2}(81 \sqrt{81}-1)=364
\end{aligned}
$$