# How to solve for a limit of summation

I have a summation formula that I have to solve for a program I'm making.

The formula is as follows:

$$z = \sum_{i=0}^x ( 2^i ) + 90$$

If I only know the $z$, how can I calculate the $x$ in this formula?
The first part is easy (subtract 90 from $z$), but I can't quite figure out the rest.

For the record, $z$ is always integer, and only integer operations are used in this formula.

-
It's a geometric series. –  M.B. Dec 3 '13 at 10:45
Your formula above is not recursive... –  Eleven-Eleven Dec 3 '13 at 10:53
Welcome to Math.SE (first post): I edited out "recursive" and made the title sensible. Given the programming aspect of the Q, it's possible the word "recursive" refers to a software concept, but is not mathematically sensible. –  hardmath Dec 3 '13 at 11:15
@hardmath thanks. I had missed that concept (in programming and maths the recursive concept is different). –  brunoais Dec 3 '13 at 12:35

$z-90=\sum_{i=0}^{x}2^i=2^0+2^1+2^2+...+2^x$
but $\frac{x^n-1}{x-1}=\sum_{k=0}^{n-1}x^n$
Thus $z-90=\frac{2^{x+1}-1}{2-1}=2^{x+1}-1\rightarrow 2^{x+1}=z-89 \rightarrow x=\frac{\ln(z-89)}{\ln(2)}-1$
@ChistopherErnst Oh, by the way, $\frac{\ln(z-89)}{\ln(2)} = log_2(z-89)$ right? –  brunoais Dec 3 '13 at 15:28
Yes, that is correct; $\frac{\ln(x)}{\ln(z)}=\log_z(x)$ –  Eleven-Eleven Dec 3 '13 at 17:04