# Need a generalized way to solve $127=1+2+2^2+…$

How can I solve this equation generally? I can solve it by checking in my calculator. But I don't know any generalized way.

$$127=1+2+2^2+2^3+....+ 2^{x-1}$$

-
Have you heard of geometric series? – String May 8 '14 at 12:18
Consider the idea $(\alpha^0+\alpha^1+...+\alpha^{n-1})\cdot(\alpha-1)=\alpha^n-1$. It will work! – String May 8 '14 at 12:20
Yes ,I have heard – Fazla Rabbi Mashrur May 8 '14 at 12:21
If you succeed from the hints I gave, then post an answer to your own question ;) – String May 8 '14 at 12:22
@String why not make it an answer? – Ruslan May 8 '14 at 14:09

The most intuitive way: \begin{align*} &\;\underbrace{1 + 1} +2+2^2+2^3+ \cdots + 2^{x-1} \\ &= \underbrace{2 + 2} + 2^2 + 2^3 + \cdots + 2^{x-1} \\ &\;\;\;= \underbrace{4 + 2^2} + 2^3 + \cdots + 2^{x-1} \\ & \; \\ & \; \\ %vertical space &\quad \quad\quad \quad\quad \; \; \; \; \; \cdots \\ & \; \\ & \; \\ %vertical space &\quad \quad \quad \quad = \underbrace{2^{x-1} + 2^{x-1}} \\ &\quad \quad \quad \quad \quad \quad = 2^x \\ \end{align*} Hence, $$1 + 2 + 2^2 + 2^3 + \cdots + 2^{x-1} = 2^x - 1.$$

-

Let $S=1+2+2^2+2^3+....+ 2^{x-1}$, then $2S=2+2^2+2^3+....+ 2^{x}$. So $2S-S=S=2^{x}-1$. Can you take it from here?

-

Hint: $127=a\cdot \dfrac{r^{\text{number of terms}}-1}{r-1}$, where $a=$starting term, $r=$common ratio

-

## Prerequisites

Expanding $(\alpha^0+\alpha^1+...+\alpha^{n-1})\cdot(\alpha-1)$ in a clever way yields $$\alpha\cdot(\alpha^0+\alpha^1+...+\alpha^{n-1})-1\cdot(\alpha^0+\alpha^1+...+\alpha^{n-1})$$ where the trained eye sees that everything but $\alpha^n$ from the first product and $-1$ from the second cancels. Thus it follows (dividing by $\alpha-1$) that $$(\alpha^0+\alpha^1+...+\alpha^{n-1})=\frac{\alpha^n-1}{\alpha-1}$$ which is probably found in your book under the subject of geometric series.

## Solution

Applying the above with $\alpha=2$ shows that $$f(x)=1+2+2^2+...+2^{x-1}=\frac{2^x-1}{2-1}=2^x-1$$ so to solve $f(x)=127$ we have $2^x=128\iff x=\frac{\log(128)}{\log(2)}=7$.

-