How to calculate number of years in compound interest

finance

I'm trying to calculate the number of years in compound interest, but I find that the online formula can't get the answer I want. I don't know why. Does anyone know what the specific formula is? I know the calculator can done that, but I need to use formula for programming.

The formula I use is $n = \dfrac{\ln(FV / PV)}{\ln(1 + r)}$, but the result is $15.114$ something, but not as what the picture shows.

This is what suppose to be:

enter image description here

Best Answer

Because the interest in compounded half-yearly, the $r$ in your equation is $6.45\%/2$. This is how they arrive at their answer.

However, I think the question and model answer are a bit misleading. I'd usually say that the half-yearly interest is $(1+r)^{1/2}-1$, for an annual interest of $r$.

Related Question