Solution

ID: past-exam-of-the-mathematics-course-of-the-university-of-cambridge/2013/iii/paper-23/1/e/solution

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 .

New to topics? Read the docs here!