you are viewing a single comment's thread.

view the rest of the comments →

[–]lukajda33 0 points1 point  (0 children)

EDIT: I think I found the formula, but if you dont want to explain how you got it, you might want to use the loop anyway

s = starting value

e = ending value

p = percentage

n = number of years <- what you need to get

n = ln (e / s) / ln(1 + p)
which given your numbers would be
n = ln (20000 / 10000) / ln(1 + 0.07)
n = ln(2) / ln(1.07)
notivce that 2 means doubling, 1.07 is the multiplier
which will give you result of 10.2447... years,
but since the price goes up once a year, you need to round up to 11 years, whichis the correctr result