$n^2+np$ is a perfect square
Let $p > 2$ be a prime. Prove that there exists exactly one positive integer $n$ such that $n^2+np$ is a perfect square.
I tried bounding the expression $n^2+np$ between two perfect squares, but I wasn't able to because there was no constant term. We know that $n^2+np < \left(n+\frac{p}{2}\right)^2$, but I couldn't get a lower bound. How can we solve the question?
Solution 1:
First off we check that $p$ cannot divide $n$. Note that if $n= pk$ then $n^2 + np = p^2(k^2+k)$. Now this cannot be a perfect square because $k^2 < k^2+k < (k+1)^2$.
If $n$ is relatively prime to $p$, then $n+p$ is relatively prime to $n$, and $n^2+np = n(n+p)$ is a perfect square precisely when both $n$ and $n+p$ are squares. If we write $n= i^2, n+p=j^2$, then $p = j^2-i^2 = (j-i)(j+i)$. As $p$ is prime, we have $j-i=1, j+i = p$, so that $i = (p-1)/2$ and $j = (p+1)/2$.
This shows that $n = (p-1)^2/4$ is the only value for which $n^2+np$ is a perfect square.
Solution 2:
$$n^2+np=k^2 \to n^2+np-k^2=0\\ n=\frac{-p+ \sqrt{p^2+4k^2}}{2}$$
So,
$$p^2+4k^2=q^2\to p^2=(q-2k)(q+2k)$$
once $p>2$ is prime and $n>0$ (which means $k\ne 0$ and then $q-2k\ne q+2k$), then the only one possibility is write
$$q-2k=1\\ q+2k=p^2$$
what give us
$$q=\frac{p^2+1}{2}$$
and then
$$n=\frac{-p+ q}{2}=\frac{p^2-1}{4}$$