For odd , let be a nonsingular cubic Weierstrass equation of an elliptic curve over . Its Trace of Frobenius is , where is the Legendre symbol extended by . By the Euler criterion, reduce this sum to . The sum of a positive power over is zero unless divides , when it is . Since the polynomial has degree , only its coefficient contributes.
Let be the quadratic character, equivalently the Legendre symbol. Zero is included among the square residue classes. For every integer its square-class indicator is
For a nonzero quadratic residue the right side is one, for a nonresidue it is zero, and for a multiple of it is one. Summing over the interval, the character contribution is by the previous part, while the number of multiples of is . Thus the required count is
This counts the integers in the interval whose residue classes are squares. When the interval exceeds one period, repeated appearances are counted; the displayed main term could not describe a count of distinct residue classes for arbitrary .