How to solve the following Pell's equation?
$$x^{2} - 991y^{2} = 1 $$ where $(x, y)$ are naturals.
The answer is $$x = 379,516,400,906,811,930,638,014,896,080$$ $$y = 12,055,735,790,331,359,447,442,538,767$$
I can't think of any way apart from brute force. Please help.
Also, what is the general way of solving any Pell's equation?
I read the wiki article on it but couldn't get any general method to solve it.
Edit, 6 April 2014: I put some GMP oversize integers in two of my indefinite forms programs in C++, so here is the Lagrange cycle method for doing this. The importance of this is that no decimal accuracy is required at all, and no pattern recognition (cycle detection??), no memory is required at all.
I give a complete description at How to detect when continued fractions period terminates and at the MO question I link to there. You need to be very confident about using two by two matrices. However, and this is the key point, it is NOT NECESSARY to use high decimal precision. All is integer arithmetic. The only approximation is the integer part of the square root of the discriminant, as in $\left\lfloor \sqrt {3964} \right\rfloor = 62.$ The bad news is that my program is limited to number s below $2^{31},$ so the "answer" at the end was gibberish and I just erased it. Oh, this comes up sometimes...with this method, it is also not necessary to use any cycle detection. The cycle for $991$ begins with the binary form $\langle 1,62,-30 \rangle$ and ends precisely when we, once again, reach $\langle 1,62,-30 \rangle.$ Not before, not after. I have a short example, the triples may repeat the first entry, in this case 9, but you are done when all three entries match:
Let me start with an easier one, 91, where I do get an answer, then show 991 after: