User:Bguzner/sandbox

For any natural numbers $$n$$ and $$k$$ we recursively define functions $$ f_k(n) $$ as follows:

$$f_0(n) = 3*n + 1$$

$$f_k(n) = 3f_{k-1}(n) + 2^k$$

Then we can prove a direct (non-recursive) formula:

$$f_k(n) = 3^{k+1}*(n+1) - 2^{k+1}$$

In particular, for $$n = 2^m-1$$ and $$k=m-1$$:

$$f_{m-1}(2^m-1) = 3^m*2^m - 2^m = 2^m * (3^m-1)$$