101 = 100 + 1
102 = 100 + 2
103 = 100 + 3
and so on, and
99 = 100 - 1
98 = 100 - 2
97 = 100 - 3
and so on. Then the
-th term of the sum, where
, is

We want to compute the sum,

We have

but notice that in the last sum, we're just adding the same number of 1s and -1s together, so its value is 0 and

In case you're not familiar with the formula for the sum of consecutive squares, we can derive it here. Recall that


Notice that

and that


Then



Now consider the cases where
is either odd or even.
- If
is odd, we can write
, where
. Then


- If
is even, we can write
and so


The original sum is obtained by adding the odd- and even-indexed sums together:
