<s>[INST] Finding specific values of $n$ such that $n^2+3n+3$ is factorisable with certain constraints on the factors I received the following question during a Maths Olympiad:

Let $n$ be a positive integer. When is it possible to express $n^2+3n+3$ into the form $ab$ with $a$ and $b$ being positive integers, and such that the difference between $a$ and $b$ is smaller than $2\sqrt{n+1}$?

My work so far:
WLOG $a<b$. We can factor this quadratic into $(n+1)(n+2)+1$. This means both $n+1$ and $n+2$ cannot divide $n^2+3n+3$, and $a$ can at most be $n$. If $a=n$, then $b=\frac{n^2+3n+3}n=n+3+\frac3n>n+3$ and $b$ must be equal to or larger than $n+4$. The difference between $a$ and $b$ is at least $4$. We need $4<2\sqrt{n+1}\Rightarrow2<\sqrt{n+1}\Rightarrow4<n+1\Rightarrow n>3$.
Apart from this, $n^2+3n+3\equiv1,3\pmod 6$. It also seems that apart from $3$, the only primes that divide $n^2+3n+3$ are of the form $6k+1$. However this is conjecture and based on the few test cases I checked.
Quadratic residues might come in handy in this problem but I'm not sure.
How could I do this problem?
 [/INST] Let $c:=b-a$, so that $|c|<2\sqrt{n+1}$ and $a$ and $-b$ are roots of
$$X^2+(b-a)X-ab=X^2+cX-(n^2+n+3).$$
Because this quadratic has two integral roots its discriminant $\Delta$ is a perfect square, where
$$\Delta=c^2+4(n^2+3n+3).$$
Of course $c^2\geq0$ so
$$\Delta\geq4(n^2+3n+3)=(2n+3)^2+3,$$
which shows that $\sqrt{\Delta}>2n+3$. On the other hand, because $c<2\sqrt{n+1}$ it follows that
$$\Delta<4(n+1)+4(n^2+3n+3)=4(n^2+4n+4)=(2n+4)^2,$$
which shows that $\sqrt{\Delta}<2n+4$, a contradiction. Hence it is never possible.
</s>