4. Calculate

$$
\lfloor\underbrace{\sqrt{2017+\sqrt{2017+\cdots+\sqrt{2017+\sqrt{2017}}}}}_{2017 \text{ square roots }}\rfloor
$$

(With $\lfloor x\rfloor$ we denote the greatest integer not greater than $x$.)
4. Let's consider a sequence defined by the conditions $a_{1}=\sqrt{2017}$ and $a_{n+1}=\sqrt{2017+a_{n}}$. The value we are looking for in our problem is $\left\lfloor a_{2017}\right\rfloor$. Since $44^{2}=1936<2017<2025=45^{2}$, we have $44<a_{1}<45$, and thus $\left\lfloor a_{1}\right\rfloor=44$.

Now, similarly, since $45^{2}=2025<2061<2017+a_{1}<2062<46^{2}=2116$ and $a_{2}=\sqrt{2017+a_{1}}$, we have $45<a_{2}<46$, and thus $\left\lfloor a_{2}\right\rfloor=45$. We will prove by induction that for all $n \geqslant 2$, $\left\lfloor a_{n}\right\rfloor=45$. The base case has just been verified; further, if we assume $\left\lfloor a_{n}\right\rfloor=45$, then we have $45 \leqslant a_{n}<46$ and $45^{2}=2025<2062 \leqslant 2017+a_{n}<2063<46^{2}=2116$ and $a_{n+1}=\sqrt{2017+a_{n}}$, and we conclude $45<a_{n+1}<46$, from which it follows that $\left\lfloor a_{n+1}\right\rfloor=45$. This completes the proof by induction. From the proven statement, we immediately have $\left\lfloor a_{2017}\right\rfloor=45$.