The equation x2 - Dy2 = 1, which I call the two conics equation was supposedly well-studied by mathematicians but recent research has revealed a wealth of new information, including for the first time in human history the rules for its fundamental solutions, when you have the smallest non-trivial integer solutions.
But there is a lot more. It is a wide-open field. Here I'll consider just a few more things that occurred to me recently, for instance there is a Diophantine cycle associated with the special case of solutions where x = 1 mod D or -1 mod D.
Given x2 - Dy2 = 1, and x = 1 mod D or x = -1 mod D:
(D-1)j2 + (j+1)2 = (x+y)2, where j = ((x+Dy)-1)/D
(D-1)j2 + (j-1)2 = (x+y)2, where j = ((x+Dy)+1)/D
Here's an example with the famous large case D=61:
17663190492 - 61*2261539802 = 1
x = 1766319049, y = 226153980, and x = 1766319049 = -1 mod 61, so the second applies.
And (x+Dy+1)/D = 255110030 so the ellipse is:
60*2551100302 + 2551100292 = 19924730292
And further research shows j splits into more integers n and m: j = nm or j = 2nm
If x = 1 mod D: (n-m)2 - Dm2 = 2, or (n-m)2 - Dm2 = 1
So you cycle into more Diophantine equations. Those equations lead back to two conic equations so you have an infinite cycle, where one is actually the original two conics equation, but written in a different form, which I find amazing.
That was done by the analysis itself, as if it were correcting me.
That alternate form: (n-m)2 - Dm2 = 1
I've noted previously that leads to a quadratic residue engine:
2m = n-1(n2 - 1) mod D-1
(n - m)2 = m2 + 1 mod D-1
Here's an example with n=4:
2m = 4-1(15) mod 21 = 16(15) mod 21, and m = 15
(4 - 15)2 = 152 + 1 mod 21
which is: 112 = 16 mod 21
Which shows a forcing of quadratic residue pairs, if m does not equal 0, or if -1 is not a quadratic residue modulo D-1, which remarkably explains their appearance in lists of quadratic residues! They have no choice. These equations force their appearance.
The quadratic residue engine even allows you to count. Since the first is also:
2m = (n - n-1) mod D-1
That symmetry within means that if D-1 is a prime p, there are approximately (p-1)/2 unique m's, but since half of those m's are just negations of the original, you have a count of roughly (p-1)/4.
One thing that shifts the count is if -1 is a quadratic residue modulo p, then you subtract one more.
So the actual result is that if p is prime and -1 is not a quadratic residue modulo p, it will have (p-1)/4 quadratic pairs, else it will have (p-1)/4 - 1 = (p-5)/4 quadratic pairs. So 2, 3 and 5 do not have any with 7 being the first prime with one.
Those are then exact counts of quadratic pairs for primes. It should be possible to get counts for composites by number of unique prime factors by combinatorics, which is a result I'll leave open.
Intriguingly if D-1 only has as prime factors 2 or 3, m can equal 0 for all n, which can mean no quadratic residue pairs for D-1.
That may offer unique ways to test for primeness for instance if D-1 = 2c, where c is some arbitrarily large positive integer, then, oh, that goes back to yet another result I haven't covered in this post. Just so much territory.
It's like a wide open space when you open up something of this nature. It's hard to pick and choose among which results to discuss!
Oh, I've become distracted now by Mersenne primes. If D = 2p, then D-1 may be a Mersenne prime. Ok, off to think some more. Too many possibilities with this thing. May need a few more years.