Given an arithmetic sequence
a, a+d, a+2d, ...
where a is the initial term and d is the difference between terms,
the sum of the first n terms of the sequence is given by
a + (a+d) + ... + a+(n-1)d = sum_(k=0)^(n-1)(a+kd) = n((a_1+a_n)/2)
where a_i is the ith term in the sequence
(so a_1 = a and a_n = a + (n-1)d)
(a derivation of this formula is given below)
Applying the formula here with a = 3 and d = 6 we get
3 + 9 + 15 + ... + (3 + (22-1)6) = sum_(k=0)^(21)(3+6k)
= 22((3 + (3+21*6))/2) = 1452
.
.
.
The following is a derivation of the arithmetic sum formula, and is not strictly necessary for the solution of the above problem.
sum_(k=0)^(n-1)(a+kd) = sum_(k=0)^(n-1)a + sum_(k=0)^(n-1)kd = na + dsum_(k=0)^(n-1)k
The sum of the first n integers has the closed form
sum_(k=1)^nk = (n(n+1))/2
So applying this to the sum of the first n-1 integers gives
sum_(k=0)^(n-1)k = sum_(k=1)^(n-1)k = ((n-1)((n-1)+1))/2 = (n(n-1))/2
Thus
sum_(k=0)^(n-1)(a+kd) = na + d(n(n-1))/2 = n((2a + d(n-1))/2)
=n((a + (a + (n-1)d))/2) = n((a_1+a_n)/2)