Find a formula for this

69 Views Asked by At

I need help. I don't know if it is possible.

Example formula that uses English instead of math!

$f(x) = 3x$ + all previous values of $f(i)$ with $i$ from $0$ to $x-1$, where $x$ is a positive integer. To clarify,

$$f(0) = 0 + 0 = 0$$ $$f(1) = 3 + 0 = 3$$ $$f(2) = 6 + 3 + 0 = 9$$ $$f(3) = 9 + 9 + 3 + 0= 21$$ $$f(4) = 12 + 21 + 9 + 3 + 0= 45$$ $$...$$ I just need a formula that a computer will understand!\

For all of you out there willing to help, thank you! :)

1

There are 1 best solutions below

3
On BEST ANSWER

You have $$f(n+1) = 3n+3 + \sum_{i=0}^n f(n)$$

So basically every $3i$ term is summed $2^{n-1-i}$ times in the $n$-th term, plus the $3n$ one

$$f(n) = 3\left( n + \sum_{i=0}^{n-1} 2^{n-1-i} i \right) = 3(2^n -1) $$