This is how I would work it. Though if you want to be clever, you could calculate your payment stream in Year 17 dollars instead of Year 0 dollars, so you don’t have to discount back.

The value of an annuity is A *(1- 1/(1+r)^T)/r.

So for a flow of payments of $20,000 for 4 years assuming a 5% rate of return, the value is:

20000* (1-1/(1.05)^4)/.05 = $70,919.01 which you are going to need in 18 years (which is the start of year 18 if you are now at t=0 or Year 0).

So, you discount that back to today to get PV of the eventual payments (remember that the annuity formula is the value at the year before payments start, so 17 periods, not 18):

PV = V/(1+r)^T = 70,919.01/(1.05)^17 = $30,941.73

So, we want to make 17 years of payments (at the starts of years 1 through 17) that equal PV = $30,941.73. Using the annuity formula again:

$30,941.73 = A *(1- 1/(1.05)^17)/.05

Solve for A and you get A = $30,941.73/((1- 1/(1.05)^17)/.05) = $2,744.50

As a table:

Year Beginning Balance Ending Balance 0 $0.00 $0.00 Today 1 $2,744.50 $2,881.73 First Payment 2 $5,626.23 $5,907.55 3 $8,652.05 $9,084.65 4 $11,829.16 $12,420.62 5 $15,165.12 $15,923.38 6 $18,667.88 $19,601.28 7 $22,345.78 $23,463.07 8 $26,207.58 $27,517.95 9 $30,262.46 $31,775.58 10 $34,520.09 $36,246.09 11 $38,990.60 $40,940.13 12 $43,684.63 $45,868.86 13 $48,613.37 $51,044.04 14 $53,788.54 $56,477.97 15 $59,222.47 $62,183.60 16 $64,928.10 $68,174.51 17 $70,919.01 $74,464.96 Last Payment 18 $54,464.96 $57,188.21 First Withdrawal 19 $37,188.21 $39,047.62 Second Withdrawal 20 $19,047.62 $20,000.00 Third Withdrawal 21 $0.00 $0.00 Last Withdrawal