I hope it's not inappropriate asking this here. I stumbled upon this site recently while researching a Project Euler problem, now I figure I'd use it to ask about a recurring theme in these problems: quadratic Diophantine equations.

I've recently boiled down another Project Euler problem (I won't say which, it should be unrecognizable from the original problem and should probably be kept that way) to the following Diophantine equation:

$$5n^2+2n+1=y^2$$

I've been trying to use http://www.alpertron.com.ar/METHODS.HTM as a reference, but I seem to get lost in a sea of constants. And the steps that program on the bottom of that page takes don't seem to match what he says to do. I'd rather be able to understand the steps I'm taking anyway rather than just copying a method.

I'm interested in all positive integer values of n and I'm more or less given a solution exists with n=2. How would I go about finding the rest of the solutions? And how would I solve these kinds of equations in general? If that last part is too complex a question to be handled here, is there any other resource that might help? As far as my current level of math, I have a degree in engineering (and helped a math major with some courses I never took myself) and I've already worked on Project Euler problems involving Pell's equations and continued fraction expansions of square roots.

-

Start by completing the square on the left: $$5\big( n+\tfrac15)^2 + \tfrac45 = y^2$$ Multiply by 5 to clear denominators: $$(5n+1)^2 + 4 = 5y^2.$$ Therefore you're looking for solutions to the Pell equation $$x^2 - 5y^2 = -4$$ that happen to satisfy $x\equiv1\pmod5$ (so that $n=(x-1)/5$).
Given that you know how to solve Pell's equation, you should be able to find a way to generate all integer solutions $(x_k,y_k)$; some of these values $x_k$ will be $1\pmod 5$, and the set of such $k$ should be an arithmetic progression.
There's one obvious solution $(a,b)$ to $x^2-5y^2=-4$. Prove that if $(x,y)$ is any solution then $(u,v)$ is another given by $(u+v\sqrt5)/2=((3+\sqrt5)/2)(x+y\sqrt5)/2$. It follows that $((3+\sqrt5)/2)^r(a+b\sqrt5)/2$ gives solutions for all $r$. If you choose $r$ cleverly, you'll even get $x\equiv1\pmod5$. If that's not enough, the libraries are full of intro number theory texts that discuss quadratic diophantine equations. – Gerry Myerson Oct 23 '11 at 11:47
If you have $x^2 - 5^2 = -4$, then $(x / 2)^2 - 5 (y / 2)^2 = -1$. That I recognize as Pell's equation. – vonbrand Mar 25 at 1:15