The equation x2 - Dy2 = 1 has one of the weirdest stories in mathematics, with a convoluted history that goes back thousands of years, and the story just keeps getting stranger.
I like to call it the two conics equation because in rationals it gives you hyperbolas or ellipses depending on the sign of D, while mathematicians like to consider it only with integers and call it Pell's Equation, but then say that John Pell doesn't deserve that credit.
But they also seem to fail to mention that there was a mystery in the relation between D and the size of the fundamental solution, which is the first non-zero integer solution. And that's kind of a BIG DEAL as without that explanation the equation can seem to be a little crazy.
For instance, with D=2, it's nice and sweet with a nice and easy fundamental solution: 32 - 2(2)2 = 1
And it's hard to see easier than that! Though you often do see other solutions that are easy. And lots of them.
But then you have ones that are hard where the fundamental solution is huge, where the most famous one because Fermat used it as a challenge problem--yeah, this equation is old and was even old when he played with it--is for the D=61 case.
17663190492 - 61(226153980)2 = 1
But is immediately followed by an easy one: 632 - 62(8)2 = 1
But why? Some may know that if D+2 is a square you get easy solutions from an identity, but I can go a little further to D=72, and you get the easy: 172 - 72(2)2 = 1
Now that's just damn strange.
And if you wish you can go to a page on MathWorld where they conveniently list the solutions for D to 102--go down to the bottom half of the page to see them. They skip squares as D can't be a square, since (x - sqrt(D)y)(x + sqrt(D)y) = 1.
If you see a pattern there, then you should congratulate yourself, as then you figured out the rules!
And here they are solving an ancient math mystery:
1. If D is prime or twice a prime, solutions will tend to be larger, where that is because x = 1 mod D or -1 mod D, for those cases.
2. The more small prime factors of D-1, the larger solutions will tend to be.
3. If D is prime or twice a prime or for any other reason x = 1 mod D or -1 mod D, and D-1 has a lot of prime factors, and especially if 4 is a factor then solutions are the largest of all, unless D-1, D+1, D-2, or D+2 is a square, as then solutions will tend to be small regardless, as a sort of release valve kicks in for those special cases.
So if you figured that out then you managed to see something that I managed to prove September, when I finally got them right as for a while I missed the x = 1 mod D or -1 mod D thing for reasons that still escape me.
So now you know what Fermat didn't know, and if he had known then he'd have invented modular arithmetic, which he could have done, but history says he didn't and modular arithmetic didn't emerge fully until the 1800's and Gauss had a lot to do with that emergence.
Such a cool story. I love mentioning those names.
So today we're in the 21st century and those rules are backed by a really cool proof, which isn't very formal now as you can say, it's still at first draft as I just figured everything out. Polishing up math proofs takes time, and motivation. For now I'd like to get some attention to the result! Then can make it all pretty.
And it should be easy to get attention here. Math people didn't even realize there was a mystery, apparently mostly deciding that what they call Pell's Equation was just crazy, and it bounced around with D for no particular reason at all! Since they call it Pell's Equation and then say John Pell doesn't deserve credit, maybe they just think crazy goes with the thing.