Why is the one quadratic polynomial a perfect square more often than the other?

I should start by clarifying that both equations yield the same number of squares; both yield countably infinitely many perfect squares. Up to any given upper bound, however, the former equation produces roughly twice as many perfect squares as the latter.

Solving $5n^2+4=m^2$ over the integers is equivalent to solving the equation $$m^2-5n^2=4,$$ Similarly, solving $5n^2+2n+1=m^2$ over the integers is equivalent to solving the equation $$(5n+1)^2-5m^2=-4.$$ Intuitively the two equations $$x^2-5y^2=4\qquad\text{ and }\qquad x^2-5y^2=-4,$$ should have roughly the same number of solutions (up to any given upper bound), and indeed their solution sets are in bijective correspondence through the maps $$(x,y)\ \rightarrow\ \big(\tfrac{x+5y}{2},\tfrac{x+y}{2}\big) \qquad\text{ and }\qquad \big(\tfrac{-x+5y}{2},\tfrac{x-y}{2}\big)\ \leftarrow\ (x,y).$$ But for the second equation, you only get valid solutions to the original equation when $x\equiv1\pmod{5}$. So you might expect the first equation to have about five times as many solutions up to any given upper bound. A more careful analysis shows that you only get about twice as many solutions, though.


This answer comes from the standard method of solving the Pell equation $$x^2+Dy^2=C,$$ with parameters $D$ and $C$, where $D$ is a squarefree integer. It shows that all solutions to $$5n^2+4=m^2,$$ are parametrized by $$m_k+n_k\sqrt{5}=\pm2\left(\frac{3+\sqrt{5}}{2}\right)^k,$$ and similarly that all solutions to $$5n^2+2n+1=m^2,$$ are parametrized by $$n_k+m_k\sqrt{5}=\pm(1+\sqrt{5})\left(\frac{7+3\sqrt{5}}{2}\right)^k.$$ In particular the solution sets to both equations are exponential families, with growth factors $$\frac{3+\sqrt{5}}{2}\qquad\text{ and }\qquad \frac{7+3\sqrt{5}}{2}=\left(\frac{3+\sqrt{5}}{2}\right)^2,$$ so the former has about twice as many solutions as the latter, up to any given upper bound.