Given two natural numbers $i$ and $p$ such that $0 < i < 2^p$, a real constant $b$ must satisfy the inequality $ (2^p+i)\lg(2^p+i) - p2^p - i\lg i - (2^p+i) + \frac{2^p}{i+1} + \frac{i}{2^p+1} \leqslant b, $ where $\lg n$ is the binary logarithm of $n$. (This problem comes from the analysis of an algorithm which relies on the binary notation of $n$ when it is strictly between two consecutive powers of $2$, i.e., $n = 2^p + i$.)
I would like to show that, for all $p$ and $i$, the left-hand side has a smallest upper bound, and use it to minimize $b$. (I would hope $b_{\min} = 2$.)
How would you tackle this?