Is this BBP-type formula for $\ln 31$, $\ln 127$, and other Mersenne numbers also true?

In this post, a binary BBP-type formula for Fermat numbers $F_m$ was discussed as (with a small tweak),

$$\ln(2^b+1) = \frac{b}{2^{a-1}}\sum_{n=0}^\infty\frac{1}{(2^a)^n}\left(\sum_{j=1}^{a-1}\frac{2^{a-1-j}}{an+j}+\sum_{k=1}^{a/b-1}(-1)^{k+1}\frac{2^{a-1-bk}}{an+bk}\right)\tag1$$

where $a=2^b$ and $b=2^m$.

I was then trying to find patterns for $3\cdot2^{m}+1$ and $9\cdot2^{m}+1$, but only have tentative results so far. However, it seems Mersenne numbers are "easier" as,

$$\ln(2^b-1) = \frac{b}{2^{a-1}}\sum_{n=0}^\infty\frac{1}{(2^a)^n}\left(\sum_{j=1}^{a-1}\frac{2^{a-1-j}}{an+j}-\sum_{k=1}^{\lfloor a/b-1 \rfloor }\frac{2^{a-1-bk}}{an+bk}\right)\tag2$$

where $a=2^b-2$, $b$ an odd integer, and floor function $\lfloor x\rfloor$. Notice its satisfying similarity to $(1)$. For example, with $b=5$ then,

$$\ln 31 = \frac{5}{2^{29}}\sum_{n=0}^\infty\frac{1}{(2^{30})^n}\left(\sum_{j=1}^{29}\frac{2^{29-j}}{30n+j}-\sum_{k=1}^{5}\frac{2^{29-5k}}{30n+5k}\right)$$

Like $(1)$, I found $(2)$ using the integer relations algorithm of Mathematica (and a lot of patience and doodling).

Q: But how to rigorously prove $(2)$, and does it in fact hold for all integers $b>1$?

I'll give a proof of the corrected version of your conjectured series expansion and then comment at the end about the limits of this method for finding base 2 BBP formulas for $\log n$.
Let's denote $\alpha_b=2^b-2-b\lfloor\frac{2^b-2}{b}\rfloor$, notice that $\alpha_b=0$ for all primes $b$ but it can be nonzero for othervalues. Start by writing $$\log(2^b-1)=b\log 2+\log\left(1-\frac{1}{2^b}\right)$$ $$=b\sum_{k=1}^{\infty} \frac{1}{k2^k}-\sum_{k=1}^{\infty}\frac{1}{k2^{bk}}=\sum_{n=0}^{\infty}\frac{1}{2^{n(2^b-2-\alpha_b)}}\left(\sum_{j=1}^{2^b-2-\alpha_b}\frac{b2^{-j}}{n(2^b-2-\alpha_b)+j}-\sum_{h=1}^{\lfloor\frac{2^b-2}{b}\rfloor}\frac{2^{-bh}}{n\lfloor\frac{2^b-2}{b}\rfloor+h}\right)$$ $$=\sum_{n=0}^{\infty}\frac{1}{2^{n(2^b-2-\alpha_b)}}\left(\sum_{j=1}^{2^b-2-\alpha_b}\frac{b2^{-j}}{n(2^b-2-\alpha_b)+j}-\sum_{h=1}^{\lfloor\frac{2^b-2}{b}\rfloor}\frac{b2^{-bh}}{n(2^b-2-\alpha_b)+bh}\right)$$ $$=\frac{b}{2^{a-1}}\sum_{n=0}^\infty\frac{1}{(2^a)^n}\left(\sum_{j=1}^{a-1}\frac{2^{a-1-j}}{an+j}-\sum_{k=1}^{ a/b-1 }\frac{2^{a-1-bk}}{an+bk}\right)$$ where $a=2^b-2-\alpha_b$ which gives the correct version of your identity (and agrees with it whenever $b$ is prime).
As for the general question of which numbers $n$ give $\log n$ with a BBP formula in base $2$, such identities can be manipulated to work with all numbers $n$ such that $$n=\frac{(2^{m_1}-1)(2^{m_2}-1)\cdots(2^{m_k}-1)}{(2^{r_1}-1)(2^{r_2}-1)\cdots(2^{r_s}-1)}.$$ The first prime not expressible in this form is 23 (this can be proven using Zsigmondy's theorem, since $2^{t}-1$ always has a primitive prime factor for large enough $t$).
• Thanks. No wonder when I was numerically testing it for even $b$ that it seems it did not equate as accurately as for prime $b$. Yes, $23$ and $89$ have no known binary BBP formula and $2^{13}-1 = 23\times89$. However, I think $97 = 3\cdot2^5+1$ should have one. – Tito Piezas III Jul 8 '17 at 0:43