Compute sum of geometric sequence
let a = any number
let r = a constant multiplier (next term in sequence = previous term times r)
let S = Sum(a*rx) from x = 0 to x = n (S is sum of a geometric sequence)
S = a + a*r + a*r2 + a*r3 +.....+ a*rn-1 + a*rn
r*S = a*r + a*r2 + a*r3 +.....+ a*rn-1 + a*rn + a*rn+1
S - r*S = a - a*rn+1
S*(1-r) = a*(1-rn+1)
S = a*(1-rn+1)/(1-r) = sum of geometric sequence