TITLE: Baker-Campbell-Hausdorff formula: prime divisors of denominators
QUESTION [10 upvotes]: Consider the Baker-Campbell-Hausdorff formula (Wikipedia page):
$$Z(X,Y) := X + Y + \frac{1}{2}[X,Y] + \frac{1}{12}[X,[X,Y]] - \frac{1}{12}[Y,[X,Y]] + \dots$$
Many sources, including the Wikipedia page, have an explicit expression for the terms, so the question I'm asking should be answerable just from that expression.
For a prime p and a natural number n, denote by $f(p,n)$ the largest k such that, if we truncate the formula to terms that involve products of length at most $n$, then one or more of the denominators is divisible by $p^k$. Note that this truncation is valid when we are working in a situation of nilpotency class $n$. 
It's pretty easy to see that $f(p,n) = 0$ for $n < p$, and is nonzero for $n \ge p$.
My question: Is there a direct explicit expression for $f(p,n)$ (or a sandwiching of it between two fairly close expressions)? For instance, inspection of the first few terms suggests that $f(2,n) = n - 1$, but I'm not sure how to derive this from the general expression.
Analogue: In the power series for the exponential $e^x$, the analogue to $f(p,n)$ is the sum $[n/p] + [n/p^2] + [n/p^3] + \dots$ where $[]$ denotes the greatest integer function.
UPDATE: Chapter 3 of the Springer Lecture Notes by Klass, Leedham-Green, and Plaskett (access online if you have an a university subscription) contains some estimates. However: (i) I'm not sure all the numerical calculations there are correct, since they don't agree with others I have seen, (ii) the authors aren't concerned about the precise growth of $f(p,n)$ -- they only care that it grows slowly enough that the series converges under certain conditions.

REPLY [8 votes]: If the homogeneous component $Z_n(X,Y)$ of $Z(X,Y)$ of degree $n$ is represented in the Lyndon basis $\mathcal{L}_n$, or in any basis $\mathcal{B}_n$ whose transformation
matrix $T_{\mathcal{L_n}\to\mathcal{B_n}}$ has determinant $\pm 1$, then an explicit formula for the exponent $f(p,n)$ of the highest power of $p$ that divides the least common multiple of the denominators of the coefficients of $Z_n(X,Y)$  is given by
$$
f(p,n)=\frac{n-s_p(n)}{p-1}+\lfloor\log_p(s_p(n))\rfloor.
$$
Here, $s_p(n)=\alpha_0+\ldots+\alpha_r$ denotes the sum of the digits in the $p$-adic expansion $n=\alpha_0+\alpha_1p+\ldots+\alpha_r p^r$, $0\leq\alpha_i<p$, and $\log_p$ is the logarithm to base $p$.
This follows in a straightforward way from the analogous statement for the coefficients of $Z_n(X,Y)$ represented as a polynomial in the non-commuting variables $X$, $Y$, which was proved in

Harald Hofstätter, Smallest common denominators for the homogeneous components of the Baker-Campbell-Hausdorff series, arXiv:2010.03818.

Bases $\mathcal{B}_n$ with transformation matrix $T_{\mathcal{L_n}\to\mathcal{B_n}}$ with determinant $\pm 1$ include all Hall bases, and also the rightnormed basis of E.S.Chibrikov.