n=\frac{log\frac{{S}_{n}}{P}}{log\left(1+i \right)}.