Let $w\in S\_n$ be a permutation. Is there a reasonable "formula" for the number of elements of the initial interval $[e,w]$ of weak (Bruhat) order from the identity to $w$?


In terms of what such a "formula" might look like: if $w$ is a Grassmannian permutation of shape $\lambda$ then we have $[e,w]\simeq[\varnothing,\lambda]$, an initial interval of Young's lattice, and we can use the determinantal formula of MacMahon mentioned here: [Formula for number of edges in Hasse diagram of Young's lattice interval](https://mathoverflow.net/questions/324546/formula-for-number-of-edges-in-hasse-diagram-of-youngs-lattice-interval). More generally, if $w$ is a *fully commutative* permutation (i.e., is 321-avoiding), then $[e,w]\simeq [\mu,\lambda]$ for some skew shape $\lambda/\mu$, and we can use the linked formula of Kreweras.


Of course what a formula could look like depends on how we encode $w$, but I would be happy with anything reasonable (e.g., Lehmer code, co-code, etc.).



Formula for number of permutations less than a given permutation in weak order
By [Dittmer and Pak - Counting linear extensions of restricted posets](https://arxiv.org/abs/1802.06312) (Theorem 1.4), computing the size of $[e,w]$ is $\#$P-complete. Thus, a nice formula like the suggested $n \times n$ determinant filled with entries of easy-to-calculate permutation data would imply P$=$NP.


Though not a formula, [Bj$\ddot{\text{o}}$rner and Wachs - Permutation statistics and linear extensions of posets](https://www.sciencedirect.com/science/article/pii/009731659190075R) (Section 6) provides a bijection between $[e,w]$ and linear extensions of a canonically determined two-dimensional poset. 


