<s>[INST] Value of n for which f(n) = $\,n^2 + 9n + 30\,$ is a perfect square. I attempted this by setting $f(n) = \,m^2.\,$
So $\,n^2 + 9n + 30 = m ^2\,$.   
Then  $\,9(n + 10/3) = (m + n)(m - n)\,$.
So $m = 10/3$ and $n = -17/3$ which is incorrect.
 [/INST] If
$n^2+an+b = m^2$
then
$4n^2+4an+4b = 4m^2$.
Since
$(2n+a)^2
=4n^2+4an+a^2
$,
this means that
$(2n+a)^2-a^2+4b
= 4m^2
$
or
$a^2-4b
=(2n+a)^2-4m^2
=(2n+a-2m)(2n+a+2m)
$.
Looking at all
the possible factorizations
of $a^2-4b$
(positive and negative),
we can get the possible values of
$n$ and $m$.
If $a^2-4b = uv$,
then
$2n+a-2m = u$
and
$2n+a+2m = v$
so
$4m = v-u$,
$4n = v+u-2a$
or
$m = \dfrac{v-u}{4}$
and
$n = \dfrac{v+u-2a}{4}$.
Since we can consider
only non-negative values
of $m$,
we can restrict the factorization
to have
$v \ge u$.
Note that this requires
both $v-u$ and
$v+u-2a$
to be multiples of $4$,
which further restricts the solutions.
Also note that
since
$a^2-4b = uv
=(-v)(-u)
$,
if
$m = \dfrac{v-u}{4}$
and
$n = \dfrac{v+u-2a}{4}$
is a solution
then another solution is
$m' = \dfrac{-u-v}{4}=-m$
and
$n' 
= \dfrac{-u-v-2a}{4}
= -\dfrac{u+v+2a}{4}
= -\dfrac{u+v-2a}{4}-\dfrac{4a}{4}
= -n-a
$.
In this case,
$a=9$ and $b=30$
so
$a^2-4b = 81-120 = -39$.
Since $39 = 3\cdot 13$,
the possible factorizations
(with $v \ge u$) are
$(u, v)=
(-1, 39),
(-3, 13),
(-13, 3),
(-39, 1)$.
For these
$(v-u, v+u-2a)=(v-u, v+u-18)=
(40, 20),
(16, -8),
(16, -28),
(40, -56)$.
This are all divisible by $4$,
so we get
$(m, n)=
(10, 5),
(4, -2),
(4, -7),
(10, -14)$.
As expected,
if $n$ is a solution,
then so is
$-n-9$.
</s>