I'm working on a problem that involves the following summation: $$y=\sum_{i=0}^{x}i2^i$$ I need to determine the largest value of $x$ such that $y$ is less than or equal to some integer K. Currently I'm using a lookup table approach which is fine, but I would really like to find and understand a solution that would allow calculation of $x$.
Thank you!
Use the idendity
$$\sum_{i=0}^x i2^i=2(2^xx-2^x+1)$$
and calculate the value $x$ with binary search, for example.