I have an equation for $\sum\limits_{i=1}^ni2^i=\text{res}$
the equation is converted to $$ (n-1)2^{n+1}+2=\text{res} $$ I know the value of res but how to get value of $n$ .
It's OK to have an approximate solution.
I have an equation for $\sum\limits_{i=1}^ni2^i=\text{res}$
the equation is converted to $$ (n-1)2^{n+1}+2=\text{res} $$ I know the value of res but how to get value of $n$ .
It's OK to have an approximate solution.
I am not sure what res is, I am going to assume that it is 20 and show you how I would solve the problem.
You need to solve $$ f(n) = (n-1)2^{n+2} -18 = 0$$ The most general way to do it is the Newton's method that starts with a guess for $n$ and improves it using $$ n_{\text{improved}} = n_{\text{guess}} - f(n_{\text{guess}}) / f'(n_{\text{guess}})$$ which in your case, the improvement function on the right is $$n-{{\left(n-1\right)\,2^{n+1}-18}\over{\log 2\,\left(n-1\right)\,2 ^{n+1}+2^{n+1}}} \tag 1$$ If you start with an initial guess of $n=3$, you can keep improving to get: $$\left[ 3.0 , 2.6333 , 2.5476 , 2.5436 , 2.5436 \right] $$
Note: If res is different then change the 18 to res-2 in equation (1) and change the starting guess accordingly.
added based on what the OP tried to explain
Here is how I would find $n$ if I know res. Again, these calculations are for res = 20. Equation(1) shows how to improve the value of $n$. Starting with a initial guess of $2$, we get the following improvements...
$$\begin{align} \text{guess: $n=2.0000$,} &~~~& \text{improved: $n=2.7383$} \\ \text{guess: $n=2.7383$,} &~~~& \text{improved: $n=2.5616$} \\ \text{guess: $n=2.5616$,} &~~~& \text{improved: $n=2.5438$} \\ \text{guess: $n=2.5438$,} &~~~& \text{improved: $n=2.5436$} \\ \text{guess: $n=2.5436$,} &~~~& \text{improved: $n=2.5436$} \\ \end{align}$$
If I properly understood, the equation you want to solve for n is : $$ (n-1) \, \left(2^{n+1}\right) + 2 = \text{res} $$
The solution of this class of equations is given by Lambert function (I suggest you have a look at http://en.wikipedia.org/wiki/Lambert_W_function).
For your specific problem, the algebraic solution is given by
$n = 1 + W(z) / \log(2)$ where $z = (\text{res} - 2) \log(2) / 4$
For example, for $\text{res} = 10^4$, the above expression leads to $n = 9.24407$. For $n=9$, your summation gives $8194$ and for $n=10$, your summation gives $18434$.
As shown by user44197, Newton method will solve this problem quite simply but here you have an exact solution based on Lambert function. Where this starts to be interesting is if you look at very large values of "res" which would correspond to large values of "n". Suppose $res=10^{12}$; the exact solution is $n=33.8264$. An approximate value equal to $33.8221$ is obtained using the beginning of the approximation:
$W(z) = \log(z) - \log(\log(z)) + \log(\log(z)) / \log(z) $
given in the Wikipedia page.
Using $\text{res}=10^{1000}$, the exact and approximate solutions are equal to $3309.24$.
I know you didn't ask, but I just have to tell you:
$$f(x)=\sum_0^n(2x)^k=\frac{(2x)^n-1}{2x-1}\iff f'(x)=\sum_0^n2^k(k\cdot x^{k-1})=\left[\frac{(2x)^n-1}{2x-1}\right]'_x=\ldots$$
Your sum is $f'(1)$. Now, I'll take it that your res{ult} is a natural number, right ? In that case, first subtract $2$ from it, then factor the difference, and try to see which of its divisors is a power of $2$. :-)