1
$\begingroup$

I'm a bit stuck on how to convert a non-recursive formula.

Assuming:

f(0) = 0
f(1) = 0
f(n) = f(n - 2) + $2^{n-1}\ if\ n \ge 1$

I can see that:

f(2) = 0 + $2^{2-1}$
f(3) = 0 + $2^{3-1}$
f(4) = (0 + $2^{2-1})\ +\ 2^{4-1}$
f(5) = (0 + $2^{3-1})\ +\ 2^{5-1}$
f(6) = ((0 + $2^{2-1})\ +\ 2^{4-1}) + 2^{6-1}$
f(7) = ((0 + $2^{3-1})\ +\ 2^{5-1}) + 2^{7-1}$

therefore the pattern appears to fit:
f(n) = $2^1 + 2^3 + ... + 2^{n-3} + 2^{n - 1} \ \ \ \ \ if\ n = even$
f(n) = $2^2 + 2^4 + ... + 2^{n-3} + 2^{n - 1} \ \ \ \ \ if\ n = odd$

I can understand how to write this as a sum of $\sum_{k=1}^n2^k$ or $\sum_{k=2}^n2^k$, however how do I convert this to a non-recursive formula if the variable being changed is used as the exponent.

  • 0
    You can apply the geometric series formula to the two cases.2017-02-15
  • 0
    You might want to use $4$ as your base, and observe that $(1+x+x^2+\cdots x^n)(1-x) = (x^{n+1}-1)$2017-02-15

1 Answers 1

0

See, that you create geometric series, so $$f(n)=\begin{cases}2\frac{1-4^{\frac{n}{2}}}{1-4} &, n\in 2\mathbb{Z}\\ 4\frac{1-4^{\frac{n-1}{2}}}{1-4} &, n\not\in 2\mathbb{Z}\end{cases}$$

  • 0
    Thank you for the response, I think i'm getting there but the formula doesn't seem to work. As to why i'm not sure, but in the function above f(4) = 10 whereas the formula gives f(4) = 6.2017-02-15
  • 0
    Something went wrong with your calculations using my formula. $f(4)=2\frac{1-2^{4/2}}{1-2}=2(2^2-1)=2\cdot 3=6$2017-02-15
  • 0
    Yes sorry I phrased my reply improperly. Your formula does give f(4) = 6, but the answer to the function at f(4) is 10. $f(4) = 2 + 2^3 = 10$2017-02-15
  • 0
    @BrianGraham Yes, you are right :) I've edited my answer - now it should work fine :)2017-02-15