Simple calc for many of you, I am sure.
Panicked by high equity valuations and weak bond prospects, Joe decides to put his $1M retirement egg under the mattress, for keeps. He has 25y to live, he figures. He needs to take out $40k a year to live happily. (No heirs or charities, spend to zero.)
So he reckons he's all set if there were no inflation. But he knows that's not gonna happen.
So ... how much extra does he need to put under the mattress and leave there in order to draw $40k annually if inflation is 2.5% a year for 25y? How about if 3% ?
Comments
Reduce the number of squares on the chess board from 64 to 25 to represent the 25 years.
Reduce the multiplier from 2x to the inflation rate (e.g. 1.025 for 2.5%)
Instead of starting with 1 grain of rice, start with $40K scrip
Standard mathematical technique for solving problems  transform them to something already solved.
Even if inflation averages 2.5%/year, there's always sequence of "return" risk. You might have all the inflation in year one, in which case you'd need 25 years x $40K per year x (1.025)^25, or all the inflation could be just as Joe reaches the end of his estimated lifetime. Which brings us to longevity risk.
for this Joe, assume residence where no bond options are desirable, and assume regularity of inflation (rising line, more or less straight)
What if:
A. Joe begins the 25 year period by putting 50% into an S&P 500 index fund and 50% into GNMA funds
B. After 3 years the S&P index fund has fallen 40% in value. The GNMA funds have retained their initial value.
C. Joe than panics and moves his remaining equity balance into his GNMA funds for the duration of the 25 year term
For simplicity, let’s assume Joe’s GNMA funds’ managers achieve an annual 3.5% return over the 25 year period as the rate on the 10 year gradually increases from under 1% initially to 5% in year 25.
ISTM that that initial loss (near 20% of portfolio) over the first 3 years has done significant damage to Joe’s future earning prospects. (This proposition can be sliced and diced in a number of different ways.)

Taking into account the stocks losses in the beginning, I’m showing that w/o the annual withdrawals the sum after 25 years would have grown to approximately $1,787,262 (using 3.5% monthly compounding).
Had Joe avoided stocks altogether and gone 100% into GMNA funds at the onset (3.5% average return) he’d have approximately $2,234,007 at the end of 25 years.
Difference in return: $446,745  Approximately 25% more without having incurred the initial stock losses
* Neither hypothetical case takes into account Joe’s $40,000 yearly withdrawals, which would alter the numbers somewhat.
My interpretation of Joe's question: the 1 Million doesn't grow with inflation, but the annual spends increase each year.
An example. For convenience, say the annual inflation rate is 2%
So in Year 1, Joe's spending is 40,000;
in Year 2, Joe's spending is (1.02)*40,000 = 40,800;
in Year 3, Joe's spending is (1.02)*40,800 = (1.02^2)*40,000 =41,616;
in Year 4, Joe's spending is (1.02)*41,616 = (1.02^3)*40,000 =42,448.32;
etc, etc
in Year 25, Joe's spending is (1.02^24)*40,000 =64,337.49.
(For those of you unfamiliar with the jargon,
2*3 means 2 times 3, and
2^3 means 2 raised to the 3rd power.)
The question then becomes: what's the sum of all the annual spends?
That is, 40,000 +(1.02)*40,000+(1.02^2)*40,000+
(1.02^3)*40,000 + ...+(1.02^24)*40,000.
If we factor out the 40,000, then this total spending is
40,000 (1 +1.02+1.02^2+1.02^3+1.02^4+ ... + 1.02^24).
You could get out a calculator to add the 25 terms in the parentheses, but ...
wait for it
wait for it
there's a formula!
1 +1.02+1.02^2+1.02^3+1.02^4+ ... + 1.02^24 =(1.02^25 1)/.02
A calculator can handle the 25th power term, to get
(.64061)/.02 = 32.031,
so the total amount Joe needs to live on for 25 years is
40,000*32.031 = $1,281,212.
So he needs to find 281,212 more dollars to stash away under his mattress.
The final answers:
for inflation rate 2%, the total initial amount needed is $1,281,212;
for inflation rate 2.5%, the total initial amount needed is $1,366,311;
for inflation rate 3%, the total initial amount needed is $1,458,371;
for inflation rate 6%, the total initial amount needed is $2,194,581.
David