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:
