$400,000 with $40,000 payment right away is same as $360,000 with

$40,000 payments beginning 1 year later; the "account" will look like:

Code:

YR PAYMENT INTEREST BALANCE
00 360000.00
01 -40000.00 21600.00 341600.00
02 -40000.00 20496.00 322096.00
03 -40000.00 19325.76 301421.76
.....
12 -40000.00 5071.31 49593.08
13 -40000.00 2975.58 12568.67
14 -13322.80 754.13 .00

The formula to determine n (number of years) will give n = 13.3266....

This means the final payment is made .3266 * 365 = ~119.2 days after 13th payment:

that's unrealistic: the final payment is made 1 year later.

So final payment is calculated using end of 13th year balance:

12568.67 * .06 = 754.13, which is the interest during final year.

So the way to do all this by formula is:

1: calculate FLOOR(n) when using the formula: that'll give you 13;

2: calculate future value at period 13: that'll give you 12568.67

3: multiply that by (1 + i): 12568.67 * 1.06 = 13322.80.

So final payment is $13,322.80