I'm trying to solve this recurrence, but I don't know how to unfold it:
I am looking for a function $T:\mathbb{N}\to\mathbb{N}$ that satisfies
$$
T(n)=2 \cdot T\left(\left\lfloor\frac{n+2}{3}\right\rfloor\right) + 1
$$
for all $n\ge4$. The initial values are $T(1)=T(2)=T(3)=1$.
Question: Can I ignore that "$+2$" and solve it as it was $2T(n/3) + 1$?
Note: This comes from a from a problem that uses a V[a..b]
array and makes this return:
return V(X) + f(V, a, Y) + f(V, Z, b)
Where $Y$ is $(2a+b)/3$ and $Z$ is $(a+2b)/3$. Hence: $((b-a+3)/3) = ((n+2)/3)$.