How to solve the recurrence $T(n) = T(n-2) + log(n)$?

805 Views Asked by At

How do I solve the recurrence

$$T(n) = T(n-2) + \log(n)$$

with the condition that $T(n) = O(1)$ for $n \leq 2$?

I started by using an iterative method

$$T(n-2) = T(n - 4) + \log(n-2)$$

then substituting this into the first equation, we find

$$T(n) = T(n - 4) + \log(n-2) + \log(n)$$

Inductively, the next iteration would be

$$T(n) = T(n - 6) + \log(n - 4) + \log(n - 2) + \log(n)$$

and so I saw following pattern

$$T(n) = T(n - 2k) + \sum_{i = 0}^{k - 2} \log(n - 2i)$$

Is this pattern correct, and if so, how should I precede with next step? I am not sure how to transform this sum.