Is there an analytical solution for adding up this sequence of numbers?
$$ n + \frac{n}{2} + \frac{n}{4} + \frac{n}{8} + \ldots + 1 $$
For example, let $n=32$,
$$ 32 + \frac{32}{2} + \frac{32}{4} + \frac{32}{8}+ \ldots + 1 = 32 + 16 + 8 + 4 + \ldots + 1 $$
I believe, we can express the formula like this:
$$f(n) = \sum_{i=1}^{\log(n)} \frac{n}{2^i}$$
However, is there an analytical solution to this problem?