We will use distribution
we will multiply 6 to each variable and number in the parenthesis.
6 times x plus 6 times 4
which is 6x +24
Let's start from what we know.

Note that:

(sign of last term will be + when n is even and - when n is odd).
Sum is finite so we can split it into two sums, first

with only positive trems (squares of even numbers) and second

with negative (squares of odd numbers). So:

And now the proof.
1) n is even.
In this case, both

and

have

terms. For example if n=8 then:

Generally, there will be:

Now, calculate our sum:



So in this case we prove, that:

2) n is odd.
Here,

has more terms than

. For example if n=7 then:

So there is

terms in

,

terms in

and:

Now, we can calculate our sum:




We consider all possible n so we prove that:
Let
a1=1/40
a2=4/40
a3=9/40
a4=16/40
a5=25/40
a6=?
we know that
a2-a1=4/40-1/40----> 3/40
a3-a2=9/40-4/40-----> 5/40
a4-a3=16/40-9/40----> 7/40
a5-a4=25/40-16/40---> 9/40
the difference is
3/40,5/40,7/40.9/40,....
3/40+[2/40]---> 5/40
5/40+[2/40]---> 7/40
7/40+[2/40]---> 9/40
the next will be
9/40+[2/40]-----> 11/40
so
the next term is 25/40+[11/40]------> 36/40
the answer is
36/40
X=31, the other post justifies, I just wanted to make it more accessible for if someone just needs the answer :)