I am trying to convert the following recursive function to a non-recursive equation:
$$
f(n) =
\begin{cases}
0,&\text{if n = 0;}\newline
2 \times f(n -1) + 1,&\text{otherwise.}
\end{cases}
$$
I have calculated the results for $n = 1$ through to $n = 6$ but I cannot find a discernible pattern from which to make an equation. The results are:
$$f(1) = 1$$
$$f(2) = 3$$
$$f(3) = 7$$
$$f(4) = 15$$
$$f(5) = 31$$
$$f(6) = 63$$
I hope I have formatted this correctly (my first time using LaTex), and if anyone could offer any help that would be greatly appreciated.
Best Answer
Will you be satisfied with $f(n)=2^n-1$?