We have a function defined as :
$h(x+2)$= $ 2h(x+1)$ + $2-h(x)$ when x is even ,
$h(x+2)$=$ 3h(x)$ when x is odd.
Given two numbers $a,b$ where $a\le b$
We need to find $$\sum_{n=a}^{b} h(n)$$
$h(2)= 1 $ & $h(1)= 1$
From the second relation , i got the values of $h(2k+1)$= $3^{k}$ for $k \ge 1$.
I also figured out that the summation of even terms will be a GP , but cant seem to generalize the values of even function.
So how do we get the summation value ?
When $x = 2k$ is even,
$$\begin{align*} h(2k+2) &= 2h(2k+1) + 2 - h(2k)\\ &= 2\cdot 3^k + 2 - h(2k)\\ &= 2\cdot 3^k + 2 - \left[2\cdot 3^{k-1} + 2 - h(2k-2)\right]\\ &= 2\cdot 3^k\left(1 - 3^{-1}\right) + 2\left(1 - 1\right) + h(2k-2)\\ &= 2\cdot 3^k\left(1 - 3^{-1}\right) + 2\left(1 - 1\right) + \left[2\cdot 3^{k-2} + 2 - h(2k-4)\right]\\ &= 2\cdot 3^k\left(1 - 3^{-1} + 3^{-2}\right) + 2\left(1 - 1+1\right) + h(2k-4)\\ &= \vdots\\ &= 2\cdot 3^k\sum_{i=0}^n(-3^{-1})^{i} + 2\sum_{i=0}^n(-1)^i -(-1)^n h(2k-2n)\\ &= 2\cdot3^k\sum_{i=0}^{k-1}(-3^{-1})^{i} + 2\sum_{i=0}^{k-1}(-1)^i -(-1)^{k-1} h(2)&(n=k-1)\\ &= 2\cdot 3^k \frac{1-(-3^{-1})^k}{1-(-3^{-1})} + 2\frac{1-(-1)^k}{1-(-1)} + (-1)^k\\ &= 2\cdot 3^k \cdot \frac34\left[1-(-3^{-1})^k\right] + [1-(-1)^{k}] + (-1)^k\\ &= \frac{3^{k+1}}{2} - \frac32(-1)^k - (-1)^k + (-1)^k + 1\\ &= \frac{3^{k+1}}{2} + \frac{3(-1)^{k+1}}{2} + 1 \end{align*}$$
Then if you sum even and odd $n$ separately in $\sum_{n=a}^b h(n)$, the sum would contain more Geometric series additions.