Attached is a write-up of a final proof (it's three pages long). This problem was fascinatingly complicated. I knew virtually nothing about the Pell equation and continued fractions, so I have had the pleasant opportunity these last few days to understand how they work. Number theory really is enchanting the way a simple question can lead to an arbitrarily complex answer.

havaliza: Where the hell did this question come from? A book? A class? Your own wanderings?

After reading and understanding the attached proof, I wonder if anyone wants to look at a generalization involving x(y+n),y(x+n)...