In the infinite sequence

a, b, (a + b)/2, (a + 3b)/4, . . .

each term after the second is the arithmetic mean of the two previous terms.

Find the limit of the sequence in terms of real numbers a and b.

We can split every term in two parts, the 'a'-part and the 'b'-part; as
the arithmetic mean is a linear function, we can compute the limit of
both parts and then take the sum to abtain the final result.

For the a-part, the first two terms are 1*a and 0*a.

Simplified: 1, 0 , 1/2, 1/4, 3/8, ... It is not hard to prove that at
every odd-numbered step 2n-1 we decrease the value by 2^(-2n+2) and at
every even-numbered 2n step we increase by 2^(-2n+1). This series
converges to 1-2/3 = 1/3.

For the b-part, an analogues calculation leads to the limit of 2/3.

In total we get a/3 + 2b/3.