We want to understand how many discriminants D have solutions to negative Pell’s equation. First of all we have some local restrictions on the
the prime factors of D if there is a solution. There cannot be prime factors 3 modulo 4. If we restrict to these prime factors for D, (special discriminants) how likely is it to actually have a solution to the equation.
The total number of special discriminants less than is given by
Stevenhagen conjectured that the number of positive squarefree d for which the negative Pell equation s solvable is asymptotic to
Fouvry, Kluners detect existence of solutions to negative Pell’s equation as equality of the narrow and ordinary class group of
Now they compute joint distribution of the 4-ranks of class groups.
To access these, they use the following formulae for the ranks in terms of characters and factorization of discriminants.
On the analytic side, the use mely Siegel-Walfisz theorems and double oscillllation of the character involved.
The main term is as predicted by Cohen-Lenstra Heuristics: The prime to 2 part of the class group behaves like the prime to 2 part of a random finite abelian group– (a group with large automorphism is chosen with less probability)
In our case the main term of -th moment of the 4-rank is related to the number of subspaces of
Here is the paper:
https://annals.math.princeton.edu/wp-content/uploads/annals-v172-n3-p13-p.pdf
http://algant.eu/documents/theses/milovic.pdf (ADDED Later)