
4. Find the largest positive integer $n$ such that

$$
\lfloor\sqrt{1}\rfloor+\lfloor\sqrt{2}\rfloor+\lfloor\sqrt{3}\rfloor+\cdots+\lfloor\sqrt{n}\rfloor
$$

is a prime $(\lfloor x\rfloor$ denotes the largest integer not exceeding $x)$.

(Patrik Bak)


Solution. Consider the infinite sequence $\left\{a_{n}\right\}_{n=1}^{\infty}$ defined by $a_{n}=\lfloor\sqrt{n}\rfloor$. This sequence is clearly non-decreasing and since

$$
k=\sqrt{k^{2}}6$ then the fraction $\frac{1}{6}(k-1) k(4 k+1)$ is an integer sharing a prime factor with $k$, hence the whole right-hand side is sharing a prime factor with $k<s_{n}$ and $s_{n}$ is not a prime.

If $k \leqslant 6$ then $n<(6+1)^{2}=49$. Plugging $n=48$ into the right-hand side we get $s_{48}=203=7 \cdot 29$. For $n=47$ we get $s_{47}=197$, which is a prime. The answer is $n=47$.
