I am working on the distribution of class numbers of real quadratic fields, and reduced the problem to something about a family of cubic modular equations I have not seen before. The situation is this:
Let $n$ be a large positive integer, and define
$S_X(n)$ $:=$ { $(x,y) \in \mathbb{Z}^2 : 0 < x < y < X,\ (x,y)=1,\ \pm x^3 + x \equiv 2ny$ (mod $y^2$) }.
The problem is to find the least $X = X(n,r)$ for which the number of elements of $S_X(n)$ becomes greater than $2rn$ for $0 < r < 1$ (or to find a lower bound of $X(n,r)$ on average with respect to $n$).
A very naive but somewhat reasonable guess is that $log(X(n,r)) >> rn$ for almost all $n$. Is there any reference or typical technique to handle this?
p.s.
The points in $S_X(n)$ come from $(x,y)$ with $x^2 \equiv \mp 1$ (mod $y$), so the problem is about the distribution of the values of $\pm x^3 + x$ mod $y^2$ for all $0 < x < y$ satisfying $x^2 \equiv \mp 1$ (mod $y$).
Trivially, $S_X(n)$ can be replaced by
$S'_X(n)$ $:=$ { $(x,y,\xi) \in \mathbb{Z}^3 : 0 < x < y < X,\ (x,y)=1,\ \xi y^2 - 2ny = \pm x^3 - x $}.
so it seems that a family of elliptic curves appears in this problem (though it is not in a familiar standard form) and the distribution of the smallest integral points of these curves have something to do with class numbers; the larger the least integral points of the curves in $S'_X(n)$, the smaller the class numbers of real quadratic fields.