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?
As you suggested, WLOG, let $a \le b$, with an integer $c$ such that
$$b = a + c \tag{1}\label{eq1A}$$
The constraint then means
$$0 \le c \lt 2\sqrt{n + 1} \implies 0 \le c^2 \lt 4(n + 1) \tag{2}\label{eq2A}$$
We then get
$$\begin{equation}\begin{aligned} a(a + c) & = n^2 + 3n + 3 \\ a^2 + ac & = n^2 + 3n + 3 \\ 4a^2 + 4ac & = 4n^2 + 12n + 12 \\ 4a^2 + 4ac + c^2 & = 4n^2 + 12n + 12 + c^2 \\ (2a + c)^2 & = 4n^2 + 12n + 12 + c^2 \end{aligned}\end{equation}\tag{3}\label{eq3A}$$
Using \eqref{eq2A} gives
$$4n^2 + 12n + 12 \le (2a + c)^2 \lt 4n^2 + 12n + 12 + 4(n + 1) = 4n^2 + 16n + 16 \tag{4}\label{eq4A}$$
Note $(2n + 3)^2 = 4n^2 + 12n + 9$ is less than the lower boundary. Also, $(2n + 4)^2 = 4n^2 + 16n + 16$ is the exclusive upper boundary. This means there's no perfect square in that range, i.e., there's no integer $2a + c$ which satisfies \eqref{eq4A} and, thus, no integer $n$ matching the conditions.