Counting the Number of Points in an Algebraic Variety How can we count the number of points in
$$S = \{(x,y) \in \mathbb{Z_m}^2: x^2+ky^2 = c\}$$ where $k,c$ are some positive integers? 
 A: If k is fixed and c varies, it is a beatiful and imporatant problem.

For k=1, Jacobi is the first one who gaves the formula :
$4[D_{(4,1)}(c) - D_{(4,3)}(c)]$,
where $D_{(4,1)}(c)$ stands for the number of (positive) divisors of c which is congruent to 1 modulue 4,
and $D_{(4,3)}(c)$ stands for the number of (positive) divisors of c which is congruent to 3 modulue 4.

For the case k=2 we have a similar formula:
$2[D_{(8,1)}(c)+D_{(8,3)}(c)-D_{(8,5)}(c)-D_{(8,7)}(c)]$,
where $D_{(8,1)}(c)$ stands for the number of (positive) divisors of c which is congruent to 1 modulue 8,
and $D_{(8,3)}(c)$ stands for the number of (positive) divisors of c which is congruent to 3 modulue 8,
and $D_{(8,5)}(c)$ stands for the number of (positive) divisors of c which is congruent to 5 modulue 8,
and $D_{(8,7)}(c)$ stands for the number of (positive) divisors of c which is congruent to 7 modulue 8

For the cases k=3, 7 we have a similar formula, you can find them in ramanujan lost notebooks.
In all these cases the class group is trivial, but when it is not it has a wild behavior.
