Problem: For an integer $n > 0$,
denote by $\mathcal F(n)$ the set of integers $m > 0$ for which
the polynomial $p(x) = x^2 + mx + n$ has an integer root.
\begin{enumerate}
\item [(a)] Let $S$ denote the set of integers $n > 0$
  for which $\mathcal F(n)$ contains two consecutive integers.
  Show that $S$ is infinite but
  \[ \sum_{n \in S} \frac 1n \le 1. \]
\item [(b)] Prove that there are infinitely many positive integers $n$
  such that $\mathcal F(n)$ contains three consecutive integers.
\end{enumerate}

Solution: We prove the following.
\begin{claim*}
  The set $S$ is given explicitly by
  $S = \{ x(x+1)y(y+1) \mid x,y > 0 \}$.
\end{claim*}
\begin{proof}
  Note that $m, m+1 \in \mathcal F(n)$ if and only if
  there exist integers $q > p \ge 0$ such that
  \begin{align*}
    m^2 - 4n &= p^2 \\
    (m+1)^2 - 4n &= q^2.
  \end{align*}
  Subtraction gives $2m+1 = q^2-p^2$, so $p$ and $q$ are different parities.
  We can thus let $q-p = 2x+1$, $q+p = 2y+1$, where $y \ge x \ge 0$ are integers.
  It follows that
  \begin{align*}
    4n &= m^2 - p^2 \\
    &= \left( \frac{q^2-p^2-1}{2} \right)^2 - p^2
    = \left( \frac{q^2-p^2-1}{2} - p \right) \left( \frac{q^2-p^2-1}{2} + p \right) \\
    &= \frac{q^2-(p^2+2p+1)}{2} \cdot \frac{q^2-(p^2-2p+1)}{2} \\
    &= \frac14 (q-p-1)(q-p+1)(q+p-1)(q+p+1)
    = \frac14 (2x)(2x+2)(2y)(2y+2) \\
    \implies n &= x(x+1)y(y+1).
  \end{align*}
  Since $n > 0$ we require $x,y > 0$.
  Conversely, if $n = x(x+1)y(y+1)$ for positive $x$ and $y$ then
  $m = \sqrt{p^2+4n} = \sqrt{(y-x)^2+4n} = 2xy+x+y = x(y+1) + (x+1)y$
  and $m+1 = 2xy+x+y+1 = xy + (x+1)(y+1)$.
  Thus we conclude the main claim.
\end{proof}
From this, part (a) follows as
\[ \sum_{n \in S} n\inv
  \le
  \left( \sum_{x \ge 1} \frac{1}{x(x+1)} \right)
  \left( \sum_{y \ge 1} \frac{1}{y(y+1)} \right)
  = 1 \cdot 1 = 1.
\]

As for (b), retain the notation in the proof of the claim.
Now $m+2 \in S$ if and only if
$(m+2)^2 - 4n$ is a square, say $r^2$.
Writing in terms of $p$ and $q$ as parameters we find
\begin{align*}
  r^2 &= (m+2)^2 - 4n = m^2-4n + 4m + 4 = p^2 + 2 + 2(2m+1) \\
  &= p^2 + 2(q^2-p^2) + 2 = 2q^2 - p^2 + 2 \\
  \iff 2q^2 + 2 &= p^2 + r^2 \qquad (\dagger)
\end{align*}
with $q > p$ of different parity
and $n = \frac{1}{16} (q-p-1)(q-p+1)(q+p-1)(q+p+1)$.

Note that (by taking modulo $8$) we have $q \not\equiv p \equiv r \pmod 2$,
and so there are no parity issues
and we will always assume $p < q < r$ in $(\dagger)$.
Now, for every $q$, the equation $(\dagger)$
has a canonical solution $(p,r) = (q-1, q+1)$, but this leaves $n = 0$.
Thus we want to show for infinitely many $q$
there is a third way to write $2q^2+2$ as a sum of squares,
which will give the desired $p$.

To do this, choose large integers $q$ such that $q^2+1$
is divisible by at least three distinct $1\bmod4$ primes.
Since each such prime can be written
as a sum of two squares, using Lagrange identity,
we can deduce that $2q^2+2$ can be written as a sum of
two squares in at least three different ways, as desired.

\begin{remark*}
  We can see that $n=144$ is the smallest integer
  such that $\mathcal F(n)$ contains three consecutive integers
  and $n=15120$ is the smallest integer such that $\mathcal F(n)$
  contains four consecutive integers.
  It would be interesting to determine whether
  the number of consecutive elements in $\mathcal F(n)$
  can be arbitrarily large or is bounded.
\end{remark*}