Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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.

share|improve this question
1  
It's a geometric series. –  M.B. Dec 3 '13 at 10:45
1  
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

1 Answer 1

up vote 4 down vote accepted

$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$

share|improve this answer
    
No problem :-) +1 (and removing the comments shortly) –  Jyrki Lahtonen Dec 3 '13 at 11:17
1  
AHA! That's what was missing for me! what you wrote in that second line was the thing I was not remembering. Thank you for the help! –  brunoais Dec 3 '13 at 13:25
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.