If I undestand your question, you want the sum of 1 to 1,000 MINUS the sum of all squares up to 1,000?
The sum of 1 to 1,000 is =1,000 x 1001 / 2 =500,500
The formula for the sum of squares is:n(n + 1)(2n + 1) / 6
31(31 + 1)(2*31 + 1) / 6 =10,416. Now, we just subtract this number from the above 500,500.
500,500- 10,416 =490,084.