How long till you're broke? 
We have $B in our portfolio and it's earning an annual return
of R (for a 12.3% return, we put R = .123). At the end of each year we withdraw $P, increasing with inflation, which we assume is I (I = .03 means 3% annual inflation). We start with a portfolio worth B and we'll track the balance at the end of each year:
After 1 year our portfolio has grown to B(1+R),
and we withdraw P(1+I).
To avoid getting too messy, we'll let
By the end of the second year this portfolio has increased by a factor x = (1+R) to
There's a magic formula we can use here. It's
We jump ahead to the end of the N^{th} year.
Your portfolio is now:
Alas, that last withdrawal left us with a ZERO portfolio: So what's N, the number of years until our portfolio ran dry?
We suppose (to make life simpler) that we withdraw our first $P at the very start,
We also let z =
x/y = (1+R) / (1+I),
we can compute z = (1+R) / (1+I), hence N.
Here's a calculator to play with: ... and that's also what this spreadsheet does. Just RIGHTCLICK here and Save Target or Save Link to download.
One more thing: For example, if you assume 4.0% inflation and 7.0% return on your investments  both constant for thirty years after you begin withdrawals (fat chance!)  then the Magic Multiplier is about 20, meaning that if you want $50,000 annually from your portfolio (increasing with inflation) you should have 20 x $50,000 = $1,000,000 in your portfolio. ^{*} The equation [!] can be rewritten in the form: z^{N} = 1  (B/P)(z  1) then take the logarithm of each side. P.S. If you want the formula when the first withdrawal is after one year (instead of immediately), then just replace B by B + P in [!].
P.P.S. If I = 0 (no "inflation" ... we withdraw equal
amounts at the end of each year),
... ain't Math wunnerful? Okay, all the above assumes a constant rate of return. Does that really happen, in real life? Hardly. To get some idea of what could happen with REAL investments, where the gain increases, decreases, is larger, then smaller, sometimes positive, sometimes negative ... see Portfolio Growth. Added ... for Ed K. After N withdrawals, our portfolio is worth:
We used the magic formula to get that second term, namely: x^{N} + x^{N1}y + x^{N2}y^{2} + ... + y^{N} = (x^{N+1}  y^{N+1}) / (x  y) When x = y, this gives 0/0.
x^{N} + x^{N1}y + x^{N2}y^{2} + ... + y^{N} = x^{N} + x^{N} + ... + x^{N} = (N +1)x^{N} in which case our portfolio balance would become:
P.S.
For example, for N = 20, x = 1.1 and y = 1.1001, we get:
