You got lucky with a=2, because the expansion of "a^(n-1) + a^(n-2) + ... + a^0" is just "2^n-1" for a=2

A general formula for "a^(n-1) + a^(n-2) + ... + a^0" is: (a^n-1)/(a-1)

For example 3^4+3^3+3^2+3^1+3^0 = 81+27+9+3+1 = 121

Can be simplified using (a^n-1)/(a-1): (3^5-1) / (3-1) = (243-1)/(3-1) = 121

So, try:

S_n = a^n*S_0 + b( (a^n-1)/(a-1) )

Let us try a start value of S_0 = 20, and have a=3 and b=4

S_0 = 20

S_1 = 20*3+4=64

S_2 = 64*3+4=196

S_3 = 196*3+4=592

Let's check S_3 (n=3) using our new formula:

S_3 = 3^3 * 20 + 4 * (3^3 -1)/(3-1)

= 27*20 + 4 * 26/2

= 592

Well, that worked, let's hope others work ... over to you for checking !