Question 2Determine all positive integers $n$ for which $\frac{n^2+1}{\lfloor\sqrt n\rfloor^2+2}$ is an integer. Here $\lfloor r\rfloor$ is the greatest integer not exceeding $r$.