For a given sequence $\frac{n^2+k^2}{2n+1}$ where $k$ is a given integer and $k > 0$, is there a way to calculate how many entries will be of integer value. Or, if that is not possible, know if it will ever be of integer value after a certain point.
For example:
The sequence $\frac{n^2+16}{2n+1}$ is of integer value for $n=2$ as well as for $n=32$. Is there a way of knowing for certain that $n=32$ is the last entry of integer value?
I don't have an answer, but here are my thoughts. Let $p$ be an integer entry in the sequence, $$p = \frac{n^2 + k^2}{2n+1}$$
We can then rearrange to form a quadratic equation for $n$, for given $k,p$ $$n^2 + k^2 = p(2n+1)$$ $$n^2 - 2pn + (k^2 - p) = 0$$
For there to be solutions, the discriminant should be non-negative. But moreover, since $n$ is also integer, the discriminant should also be a perfect square, giving $$ p^2 - k^2 + p = q^2 $$
So for any $k$, there must exist integers $p,q$ satisfying the above equation for integer terms in the sequence. If you can determine the integer combinations of $p,q$ that satisfy above, that should tell how many integer terms there are in the original sequence and what terms they are.