Answer:
The even numbers between 0 and X represents an arithmetic sequence with a common difference of 2
The rule of arithmetic sequence = a + d(n - 1)
Where a is the first term and n is the number of terms
So, for the even numbers between 0 and X
The first term = a = 0
d = 2
So, we need to find n at the last term which is X
∴ X = 0 + 2 ( n -1 )
∴ n - 1 = X/2
∴ n = X/2 + 1
The sum of the arithmetic sequence = (n/2) × (2a + (n−1)d)
Substitute with a and d and X
So, the sum = (n/2) * (2*0 + (n−1)*2)
= (n/2) * ((n−1)*2)
= n(n-1)
= (X/2 + 1) * (X/2)
= X/2 by (X/2 + 1)
So, The quick way to add all even numbers between 0 and X always works.