Question 142024
The sum of the first n terms of an arithmetic progression is {{{na+(n(n-1)r)/2}}}.

Using this formula with n=12 and n=5,

{{{222=12a+(12(12-1)r)/2}}}
{{{40=5a+(5(5-1)r)/2}}}

simplifying a bit:

{{{222=12a+66r}}}
{{{40=5a+10r}}}

and simplifying a bit more:

{{{37=2a+11r}}}
{{{8=a+2r}}}

We now solve this system of equations.

*[invoke linear_substitution "a", "r", 2, 11, 37, 1, 2, 8]

a=2, r=3.

The first 4 terms of the series would be, then:
2,(2+3),(2+2(3)),(2+3(3)) which is
2,5,8,11

In order to check, which is always a good idea, we can only iterate:
2+5+8+11+14=40  (first part is correct)
2+5+8+11+14+17+20+23+26+29+32+35=222 (second part is correct).