Known since antiquity: x2 - Dy2 = 1
The smallest integer solution by absolute value for x and y, not zero is called the fundamental solution. Sometimes it can be quite large, but why?
For example, for D = 61, the fundamental solution is quite large:
17663190492 - 61(226153980)2 = 1
Part of the key to the answer--hidden in simple math for millennia:
(D-1)j2 + (j - 1)2 = (x+y)2,
where j = (x+Dy+1)/D, so our x, gives: j = 255110030.
60*2551100302 + 2551100292 = 19924730292
A connection like no other, an ellipse to a hyperbola--an answer? Part of it.
Here's another example, for D = 313, which I found in a Wikipedia article:
321881208291348492 - 313(1819380158564160)2 = 1
j = 1922217605302610
312*19222176053026102 + 19222176053026092 = 340075009876990092
That one is too big for my pc calculator, though I could program something to check it, I'll use another trick.
I know that when x = -1 mod D that x+y+j-1 must be a perfect square or twice one.
That's an absolute by the way.
And yup, x+y+j-1 = 2*1340330532 so it works! Oh yeah, same thing works above, which is another clue.
If x = -1 mod D and x2 - Dy2 = 1, with all nonzero positive integers, then these equations apply, across infinity. So oh yeah, it's an infinity result. I get a kick out of those things, try now to note when I have one.
Oh yeah, remembered I could use Wolfram Alpha and everything checked out ok there.
Who knew? Ellipses and hyperbolas, like a freaky number family?
Of course I have the full answer. It's ok. To me it's just nice to know, but I like having answers to mysteries.