sum of x^2 for x between 1 and n