I’m going to try and approach this from first principles. I don’t understand much about the calculations, so we need to take this slow.

This all seems to come from the compound interest formula A = P(1 + r/n) ^ (n*t) where:

- A = final amount
- P = initial principal
- r = interest rate
- n = number of times applied per time period
- t = number of time periods

where in the working example that I have, A is 2000, P is 1300, r is 9%, n is 12, and t is the number of years.

Because t is the unknown we are interested in, we need to calculate what is t.

We end up with the following formula:

2000 = 1300 * (1 + 0.09 / 12) ^ (12 * t)

and need to solve for t.

Dividing by 1300 gives us:

2000/1300 = (1 + 0.09 / 12) ^ (12 * t)

Moving the plus to the numerator gives us:

2000/1300 = ((12+0.09) / 12) ^ (12 * t)

We can now take the natural log of both sides, which gives:

log(2000/1300) = log(((12+0.09) / 12) ^ (12 * t))

Why that helps, is we can now move the power part to the front of the log:

log(2000/1300) = (12 * t) * log((12+0.09) / 12)

And we can then solve for t

log(2000/1300) / (12 * log((12+0.09) / 12)) = t

That should give us about 4 years, and when working this out in the browser console, I see:

```
> Math.log(2000/1300) / (12 * Math.log((12+0.09) / 12))
4.804403780771735
```

So we seem to be on the right track. We now have a formula for calculating the number of years of compounding interest.

Next up is to compare it with the formula that you are using, and to investigate what happens when we use a million dollars.

Am I on the right track so far?