Answer :- f we consider the sum:

∑ i^2, where 1 ≤ i ≤ (p-1)/2 (note: only half of the squared numbers)

It is possible to show (by induction) that this sum can be calculated as

∑ i^2 = (p-1)*p*(p+1)/24

Hence the sum of the quadratic residues can be divided by p. (Why does it suffice to sum the first half of the squared numbers between 1 and p-1?).

On the other hand we have the sum:

∑ k, where 1 ≤ k ≤ p-1 (all residues mod p both quadratic and non-)

This is known as

∑ k = (p-1)*p/2

And is clearly divisible by p. Since the sum of the quadratic residues is part of this sum and is divisible by p then the rest of this sum, namely the quadratic non residues, has to be divisible by p.

and also know about How to Factor a Number.