0
$\begingroup$

I am trying to calculate the total amount required in a retirement account given

  • $S$: starting amount
  • $P$: first year payment
  • $i$: decimal inflation rate
  • $I$: $1 + i$
  • $y$: decimal yield on balance
  • $Y$: $1 + y$
  • $N$: number of years of retirement

If the retirement is 1 year ($n = 1$), we have

$0 = S - P$

Solving for $S$,

$S = P$

If the retirement is 2 years,

$0 = (S - P)Y - PR$

Solving for $S$,

$S = \dfrac{PR}{Y} + P$

For 3 years,

$0 = ((S - P)Y - PR)Y - PR^2$

and solving for $S$,

$S = \dfrac{\dfrac{PR^2}{Y} + PR}{Y} + P$

I am starting to see a pattern here :-), and I (think I) solved it with a loop:

S = 0
for (n = N - 1; n > 0; n--) {
    S = S + P * R^n / Y
}
S = S + P

Is there a way to simplify the progression and not use a loop?

1 Answers 1

1

To your formula

$S = \dfrac{\dfrac{PR^2}{Y} + PR}{Y} + P$

use the distributive property, and:

$S = \dfrac{PR^2}{Y^2} +\dfrac{PR}{Y} + P$

  • 0
    That actually occurred to me during the middle of the night. I corrected my loop first thing this morning.2017-01-20