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.
 A: If $n>0$ then
By comparison we have
$$ (n+4)^2 <n^2+9n+30 < (n+6)^2$$
Therefore
$$n^2+9n+30=(n+5)^2$$
Thus 
$$n=5$$
If $n\leq0$, similarly
$$(n+5)^2<n^2+9n+30< (n+4)^2$$ for all $n<-14$
Now we only need to consider the case $-14\leq n \leq 0$
Manually, it leads to $n=-14$, $n=-7$ and $n=-2$
A: Let's assume that $n$ is positive. Observe that
$$(n+4)^2=n^2+8n+16<n^2+9n+30<n^2+12n+36=(n+6)^2$$ and the only possibility is $n^2+9n+30=(n+5)^2$.
Now, let's assume that $m=-n$ is positive and $m^2-9m+30$ is perfect square. Also observe that$$(m-5)^2=m^2-10m+25<m^2-9m+30$$
and when $m$ is large enough, $m^2-9m+30<m^2-8m+16=(m-4)^2$ and you can check the case $m^2-9m+30 \ge (m-4)^2$ manually.
A: Hint:
Let $n^2+9n+30=(n+a)^2$ where $a$ is any integer
$\iff n=\dfrac{a^2-30}{9-2a}$ which has to be an integer
Now if integer $d(>0)$ divides both $a^2-30,9-2a;$
$d$ must divide $2(a^2-30)+a(9-2a)=9a-60$
$d$ must divide $-9(9-2a)-2(9a-60)=39$
So, a necessary condition for $(9-2a)|(a^2-30)$ is $9-2a$ must divide $39$
A: 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$.
