TITLE: Prove or disprove that, for any $n \in \mathbb{N_+}$, there exist $a,b \in \mathbb{N_+} $ such that $\frac{a^2+b}{a+b^2}=n.$
QUESTION [31 upvotes]: Problem
Prove or disprove that, for any $n \in \mathbb{N_+}$,
there exist $a,b \in \mathbb{N_+} $ such that $$\frac{a^2+b}{a+b^2}=n.$$
My Thought
Assume that the statement is ture. Then, the equality is equivalent to that
$$a^2-na+b-nb^2=0.$$
Regard it as a quadratic equation with respect of $a$.Then $$a=\dfrac{n \pm \sqrt{n^2+4nb^2-4b}}{2}.$$ Thus, $n^2+4nb^2-4b$ must be a square number. Let
$$n^2+4nb^2-4b=k^2,k \in \mathbb{N_+}.$$
How to go on with this? May it work?
P.S.
The statement seems to be true. Here are parts of verification examples:
\begin{array}{r|r|r}
               n&a&b \\ \hline
           1&1&1\\
           2&5&3\\
           3&5&2\\
           4&10&4\\
           5&27&11\\
           6&69&27\\
           \vdots&\vdots&\vdots
\end{array}
Besides, the equation could be rewritten as 

$$n(2a-n)^2-(2nb-1)^2=n^3-1,$$

which is a $\textbf{ Pell-like equation}$. This will help?

REPLY [8 votes]: Solution for non-square $n$ is provided in @Oldboy's answer and in linked questions. This answer handles the case for square $n$.
Case 1: $n=k^2,k \equiv 0 \pmod {2}$
Choose 
\begin{align}
a=\frac{k^2(k^3+2)}{4},
b=\frac{k^4}{4}.
\end{align}
Conditions imply that $k^2 \equiv 0 \pmod {4}$ and so both $a$ and $b$ are integers. By algebraic manipulation we can show that $(a^2+b)/(b^2+a)=k^2=n$ (it is quite technical).
Case 2: $n=k^2,k \equiv 1 \pmod {2}$
Choose
\begin{align}
a=\frac{(k^2+1)(k^2-k+2)}{4}, b=\frac{(k-1)(k^2+1)}{4}.
\end{align}
Here $2 \mid k^2+1$ and $2 \mid k^2-k+2$ implies $a$ is an integer and similarly $2 \mid k-1$, $2 \mid k^2+1$ for $b$. Again it can be verified that $(a^2+b)/(b^2+a)=k^2=n$.
This result is obtained by mindless following of solution of quadratic diophantine equation on https://www.alpertron.com.ar/QUAD.HTM. Basically for square $n$ and our equation the site instructs us to find $(X-\sqrt{n}Y)(X+\sqrt{n}Y)=4n(n^3-1)$ such that $4n \mid Y+2$ ($2$ being calculated there as $\beta$ and $4n$ being a determinant). So the problem is essentially to look at divisors $d$ of $4n(n^3-1)$ that satisfy above divisibility criteria. For $n=k^2$ the factorization is $2\cdot2\cdot(k-1)k^2(k+1)(k^2-k+1)(k^2+k+1)$ (not into primes, but fortunately this is enough). So by testing combinations of these factors (using Maple e.g.), it turns out that choices of $d=2k$ and $d=2k(k+1)$ work (for even and odd $k$ cases respectively, that is). Those choices when substituting all the way back simplify to the cases described above, but it is too long/technical to get there...