# Solve for n in Compound Interest Formula

I would like to solve the compound interest formula $$V = Pz^n + c\left(\frac{z^{n+1}-z}{z-1}\right)$$ for $n$. Or, given what I would like the final value to be, the amount I can save a year, an interest rate, and how much money I have to invest initially, I would like to find how long it would take to reach my goal.

-

We have: \begin{align*} V &= Pz^n + c\left(\frac{z^{n+1}-z}{z-1}\right)\\ V(z-1) &= Pz^n(z-1) + cz^{n+1} - cz\\ V(z-1) &= Pz^{n+1} - Pz^n + cz^{n+1} - cz\\ V(z-1) + cz &= z^n(Pz - P + cz)\\ \frac{V(z-1) + cz}{(P+c)z - P} &= z^n\\ \ln(V(z-1)+cz) - \ln((P+c)z - P) &= n\ln(z), \end{align*} so $$n= \frac{\ln(V(z-1)+cz) - \ln((P+c)z-P)}{\ln z}.$$ You can use logarithms base 10 (or any base) if you prefer.