1. in order to withdraw $40,000 per year for 30 years, it is necessary to have $40,000/year x 30 years = $1,200,000
2. to figure the annual deposit, which plus annual interest would amount to $1,200,000, it is necessary to use the formula
Future value = Principal x[ (1 + Interest)t - 1 ) / Interest]
$1,200,000 = P [ (1.078)20 - 1) / 0.078]
$1,200,000 = P(44.756)
$26,810 ≅ P