A geometric series is a series of the form
c + cr + cr^2 + cr^3 +...= Σ K=0
Use closures to define a function geometric_sequence(c, r) which returns a function f such that f(n) is the term of the sequence {c, cr, cr^2, cr^3,...} with index n. (Observe f(0) = c, f(1) = cr, f(2) = cr^2 and so on.)