Levels, ascents, and descents in restricted-growth words of type \(B\)

Toufik Mansour1, Amir Safadi1
1Department of Mathematics, University of Haifa, 3103301 Haifa, Israel

Abstract

In this paper, we enumerate restricted-growth words of type \(B\) associated with signed set partitions with respect to several statistics related to levels, ascents, and descents. For each case, we investigate these words according to four types of statistics and study the total of each statistic individually. Furthermore, we determine both the ordinary and the exponential generating functions for the total of each statistic under consideration.

Keywords: restricted-growth words of type B, signed set partitions, generating functions

1. Introduction

A set partition of \([n]=\{1,2,\ldots,n\}\) of type \(A\) is a collection \(B_1,B_2,\ldots, B_k\) of nonempty disjoint subsets of \([n]\) such that \(B_1\cup B_2\cup\cdots\cup B_k=[n]\). In this case, the subsets \(B_1,B_2,\ldots,B_k\) are called blocks and we assume that the blocks are listed in increasing order of their minimal elements, that is, \(\min B_1 < \min B_2 <\cdots< \min B_k\). Any set partition \(B_1,B_2,\ldots,B_k\) of \([n]\) of type \(A\) can be represented by a restricted growth function (RGF) \(\pi_1\pi_2\cdots\pi_n\), where \(\pi_i=j\) if \(i\in B_j\). For example, the set partition \(\{1,3,5\},\{2,6\},\{4,8\},\{7\}\) of type \(A\) is represented by the RGF \(12131243\). A level (respectively, ascent, descent) in a RGF \(\pi=\pi_1\pi_2\cdots\pi_n\) is an index \(1\leq j\leq n-1\) such that \(\pi_i=\pi_{i+1}\) (respectively, \(\pi_i<\pi_{i+1}\), \(\pi_i>\pi_{i+1}\)). In the last decades, the area of statistics on set partitions of type \(A\) has received a lot of attention (see [8] and references therein). In particular, they studied the statistics levels (number of subwords \(aa\) with \(a\geq1\)), ascents (number of subwords \(ab\) with \(1\leq a<b\)), and descents (number of subwords \(ba\) with \(1\leq a<b\)). Mansour and Munagi [10] derived an explicit generating function for the number of set partitions of type \(A\) of length \(n\) (marked by \(x\)) with \(k\) blocks (marked by \(y\)) according to the number of levels (marked by \(\ell\)), ascents (marked by \(r\)), and descents (marked by \(d\)):

\[P(x,y;r,\ell,d)=1+\sum\limits_{i\geq0}\frac{x^iy^i(r-d)^i}{(1+x(d-\ell))^i\prod_{j=1}^i\left(r-d\frac{(1+x(r-\ell))^i}{(1+x(d-\ell))^i}\right)}.\tag{1}\]

Later, Mansour and Munagi [9] (for some combinatorial proofs, see Shattuck [14]) studied the number of set partitions of length \(n\) of type \(A\) according to word-statistics \(\ell\)-levels (\(\ell-1\) consecutive levels), \(\ell\)-rises (\(\ell-1\) consecutive ascents), and \(\ell\)-descents (\(\ell-1\) consecutive descents). Some of their results were further extended to three-letter subword patterns by Mansour and Shattuck [11] and to families of subword patterns by Mansour, Shattuck, and Yan [12]. Moreover, [9, 12, 14] studies the total number of occurrences of a fixed subword pattern.

Goyt and Pudwell [5, 6] extended the notion of set partitions of type \(A\) to include colored set partitions. A colored set partition of \([n]\) of type \(A\) is a set partition of \([n]\) of type \(A\) where each element in its blocks is assigned one of \(c\) colors. For instance, all RGF of all colored set partitions of \([3]\) of type \(A\) with \(2\) colors are \(111\), \(112\), \(121\), \(122\), and \(123\), where each letter is colored by one of the two colors, that is, there are \(40\) such colored set partitions. When we specialize to the case \(c=2\), their construction aligns closely with our definition of set partitions of type \(B\), though it arises from a combinatorial perspective rather than from Reiner’s algebraic framework (see Dolgachev-Lunts [3, p. 755] and Reiner [13, Section 2]).

Now we are ready to present the definition of set partitions of type \(B\) (for instance, see [1, 2]). A set partition of \([n]\) of type \(B\) or a signed set partition is a set partition of the set \([\pm n]=\{\pm1,\dots,\pm n\}\) such that the following conditions are satisfied:

  • If \(B\) appears as a block, then \(-B\) (which is obtained from \(B\) by negating all its elements) also appears in that partition.

  • There exists at most one block satisfying \(-B=B\). This block is called the zero block (if it exists, it is a subset of \([\pm n]\) of the form \(\{\pm i \mid i \in C\}\) for some \(C \subseteq [n]\)).

For instance, the following is a set partition of \([6]\) of type \(B\) \[\label{example of standard presentation} \{1,-1,3,-3\},\{-2,-4,5\},\{2,4,-5\},\{-6\},\{6\}.\]

For simplicity, we write for the pair of blocks \(B,-B\), only the representative block containing the minimal positive number appearing in \(B \cup -B\). In the above example, the set partition of \([6]\) of type \(B\) is represented as \(\{1,-1,3,-3\},\{2,4,-5\},\{6\}\). Moreover, from now, we write first the zero block and denote it by \(B_0\) if it exists and then the non-zero blocks of a set partition of type \(B\) in such a way that the sequence of absolute values of the minimal elements of the blocks is increasing. In this context, we call this the standard presentation.

Now we are ready to define a restricted-growth (RG-)word of type \(B\) (or just RG-word) for a set partition of \([n]\) of type \(B\) written in a standard presentation. Let \(\Sigma^B=\{0,\pm 1,\pm 2,\dots,\pm n\}\) with the following order on \(\Sigma^B\): \[0 \prec -1 \prec 1 \prec -2 \prec 2 \prec \cdots \prec -n \prec n.\]

A restricted-growth (RG-)word of type \(B\) of length \(n\) is a word \(\omega=\omega_1\omega_2\cdots \omega_n\) in the alphabet \(\Sigma^B\) which satisfies \[\label{cond 2ba} \omega_1\in\{0,1\},\qquad \omega_j\preceq \max\left\{|\omega_1|,\dots,|\omega_{j-1}|\right\}+1,\quad 2 \leq j \leq n,\] with respect to the order defined above. In the case that \(|\omega_j|=\max\left\{|\omega_1|,\dots,|\omega_{j-1}|\right\}+1\), we demand \(\omega_j>0\). We denote the set of all RG-words of type \(B\) of length \(n\) whose maximal element is \(k\) by \(R^B(n,k)\). Define \({{\mathcal R}_n^B}=\bigcup\limits_k R^B(n,k)\) and \({{\mathcal R}^B}=\bigcup\limits_{n\geq0}{{\mathcal R}_n^B}\).

Definition 1.1. Let \(P=B_0,B_1,\dots ,B_k\) be any set partition of \([n]\) of type \(B\), written in its standard presentation. We associate \(P\) with an RG-word \(\omega=\omega_1 \cdots \omega_n\) of type \(B\) as follows: for each \(1 \leq j \leq n\), if the element \(j\) appears in the representative block, then \(\omega_j\) is the number of the block containing \(j\); otherwise, \(\omega_j\) is the number of this block, with a negative sign. Note that if \(j\) is the smallest element in its block (in absolute value), then it should appear in the representative block by definition, so that we demand that \(\omega_j>0\).

For instance, let \(P=B_0=\{2,5,-2,-5\},B_1=\{1,-7 \},\ B_2=\{3, -4,6\}\) be a set partition of the set \([7]\) of type \(B\), given in its standard presentation. Then, its associated RG-word of type \(B\) is given by \(\omega=102(-2)02(-1)\).

Bagno, Garber, Mansour, and Safadi [2] studied pattern avoidance in RG-words of type \(B\) by enumerating the avoidance classes for all patterns of lengths \(2\) and \(3\) using generating-tree techniques. They also establish new connections with quasi-symmetric functions by proving symmetry and Schur-positivity for several naturally arising families.

Motivated by the level, ascent, and descent statistics on set partitions of type \(A\) and the results of [2], we now define the following statistics on RG-words \(\omega=\omega_1\omega_2\cdots\omega_n\) of type \(B\) of length \(n\):

  • A level of first, second, third, fourth kind is an index \(1\leq j\leq n-1\) such that \(\omega_1=\omega_2>0\), \(\omega_1=-\omega_2>0\), \(-\omega_1=\omega_2>0\), \(\omega_1=\omega_2<0\), respectively.

  • An ascent of first, second, third, fourth kind is an index \(1\leq j\leq n-1\) such that \(0<\omega_1<\omega_2\), \(0<\omega_1<-\omega_2\), \(0<-\omega_1<\omega_2\), \(\omega_2<\omega_1<0\), respectively.

  • A descent of first, second, third, fourth kind is an index \(1\leq j\leq n-1\) such that \(\omega_1>\omega_2>0\), \(\omega_1>-\omega_2>0\), \(-\omega_1>\omega_2>\), \(0>\omega_1>\omega_2\), respectively.

For example, the RG-word \(\omega=102(-2)11(-1)3(-2)2\) of length \(10\) of type \(B\) contains one level of first kind (\(11\)), two levels of second kind (\(2(-2)\), \(1(-1)\)), one level of third kind (\((-2)2\)), one descent of first kind (\(10\)), one descent of second kind (\(3(-2)\)), one descent of third kind (\((-2)1\)), one ascent of first kind (\(02\)), and one ascent of third kind (\((-1)3\)).

The aim of this paper, is to count the RG-words of type \(B\) according to the statistics level, ascent, descents of these four kinds. The paper is organized as follows. In Section 2, we present the basic version of the scanning-element algorithm that we use to obtain the recurrence relations of the results of the paper. In Section 3, we treat the counting \(RG\)-words of type \(B\) according to the statistic level of first, second, third, and fourth kind; see Table 1.

Table 1. Exponential generating function for the total of the statistic in the question over all the \(RG\)-words of type \(B\)
Statistic \(f\) Exponential generating function for the total of \(f\) over \({\mathcal R}^B\) Reference
level of first kind
\[\int_0^x(x/2-1)e^{t+(e^{2t}-1)/2}dt+\frac{1+2x}{4}e^{x+(e^{2x}-1)/2}\]
Thm. 3.4
level of second kind
\[\int_0^x\frac{e^{2t}-3-2t}{4}e^{t+(e^{2t}-1)/2}dt+\frac{x}{2}e^{x+(e^{2x}-1)/2}\]
Thm. 3.5
level of third kind
\[\frac{1}{4}+\frac{2x-1}{4}e^{x+(e^{2x}-1)/2}-\frac{1}{2}\int_0^xte^{t+(e^{2t}-1)/2}dt\]
Thm. 3.6
level of fourth kind
\[\frac{1}{4}+\frac{2x-1}{4}e^{x+(e^{2x}-1)/2}-\frac{1}{2}\int_0^xte^{t+(e^{2t}-1)/2}dt\]
Thm. 3.7
absolute level
\[\int_0^x\int_0^te^{t+(e^{2r}-1)/2}drdx+e^x\int_0^x\int_0^te^{-t+3r+(e^{2r}-1)/2}(2re^{2r}+5r+2)drdt\]
Thm. 3.8
level
\[xe^{x+(e^{2x}-1)/2}-\int_0^xe^{t+(e^{2t}-1)/2}dt\]
Thm. 3.9

In Section 4, we treat the counting \(RG\)-words of type \(B\) according to the statistic ascent of first, second, third, and fourth kind; see Table 2.

Table 2. Exponential generating function for the total of the statistic in the question over all the \(RG\)-words of type \(B\)
Statistic \(f\) Exponential generating function for the total of \(f\) over \({\mathcal R}^B\) Reference
ascent of first kind
\[\frac{1}{32}\int_{0}^{x}e^{t+(e^{2t}-1)/2}(35+(4t-7)e^{4t}+4(4t+1)e^{2t})dt+\frac{1}{2}e^{x+(e^{2x}-1)/2}(e^{2x}-3)+1\]
Cor. 4.2
ascent of second kind
\[\frac{1}{32}\int_0^xe^{t+(e^{2t}-1)/2}((4t-3)e^{4t}+4(4t-1)e^{2t}+7)dt\]
Cor. 4.4
ascent of third kind
\[\frac{1}{32}\int_0^xe^{t+(e^{2t}-1)/2}((4t+1)e^{4t}+4(4t-3)e^{2t}+11)dt\]
Cor. 4.6
ascent of fourth kind
\[\frac{1}{32}\int_0^xe^{t+(e^{2t}-1)/2}((4t-3)e^{4t}+4e^{2t}-1)dt\]
Cor. 4.8
absolute ascent
\[\frac{1}{8}\int_0^xe^{t+(e^{2t}-1)/2}((4t-3)e^{4t}+8e^{2t}+11)dt+\frac{1}{2}e^{x+(e^{2x}-1)/2}(e^{2x}-3)+1\]
Cor. 4.10

In Section 5, we treat the counting \(RG\)-words of type \(B\) according to the statistic descent of first, second, third, and fourth kind; see Table 3.

Table 3. Exponential generating function for the total of the statistic in the question over all the \(RG\)-words of type \(B\)
Statistic \(f\) Exponential generating function for the total of \(f\) over \({\mathcal R}^B\) Reference
descent of first kind
\[\frac{1}{4}e^{x+(e^{2x}-1)/2}((2x-1)e^{2x}+1)-\frac{1}{32}\int_0^xe^{t+(e^{2t}-1)/2}((12t-9)e^{4t}+(32t-4)e^{2t}+13)dt\]
Thm. 5.1
descent of second kind
\[\frac{1}{4}e^{x+(e^{2x}-1)/2}((2x-1)e^{2x}+1)-\frac{1}{32}\int_0^xe^{t+(e^{2t}-1)/2}((12t-9)e^{4t}+(32t-4)e^{2t}+13)dt\]
Thm. 5.2
descent of third kind
\[\frac{1}{32}\int_0^xe^{t+(e^{2t}-1)/2}((4t-3)e^{4t}+4(4t-1)e^{2t}+7)dt\]
Thm. 5.3
descent of fourth kind
\[\frac{1}{32}\int_0^xe^{t+(e^{2t}-1)/2}((4t-3)e^{4t}+4e^{2t}-1)dt\]
Thm. 5.4
absolute descent
\[\frac{1}{8}\int_0^xe^{t+(e^{2t}-1)/2}((4t-1)e^{4t}+8te^{2t}+1)dt\]
Thm. 5.5
descent
\[\frac{1}{8}\int_0^xe^{t+(e^{2t}-1)/2}((4t-1)e^{4t}+2(6t+1)te^{2t}-1)dt\]
Thm. 5.6

In each case, we give an explicit formula for the corresponding ordinary generating functions, and from it we derive the ordinary and exponential generating function for the total of the statistic in the question over all the \(RG\)-words of type \(B\).

2. Scanning-elements algorithm

Motivated by the scanning-elements algorithm in permutations [4], we describe the scanning-elements algorithm for RG-words of type \(B\) in \(\mathcal{R}^B\) as follows. Let \(f\) be any statistic on RG-words of type \(B\) in \(\mathcal{R}^B\) Denote the generating function for the number of RG-words of type \(B\) in \(\mathcal{R}^B\) according to the statistic \(f\) by \(F(x;q)\), namely, \[F(x;q)=\sum\limits_{n\geq0}x^n\sum\limits_{\pi\in\text{ RG-words of type }B\text{ in }\mathcal{R}^B}q^{f(\pi)}.\]

The main goal of this section is to describe how to derive a system of recurrence relations involving the generating function \(F(x;q)\). Given \(b_1,b_2,\ldots,b_k\), we define \[F_{b_1b_2\cdots b_k}(x;q)=\sum\limits_{n\geq k}x^{n-k}\sum\limits_{\pi=b_1b_2\cdots b_k\pi’\in\text{ RG-words of type }B\text{ in }\mathcal{R}^B}q^{f(\pi)}.\]

By the definitions, we have \[F_{b_1b_2\cdots b_k}(x;q)=q^{f(b_1b_2\cdots b_s)} +x\sum\limits_{0\prec b_{k+1}}F_{b_1b_2\cdots b_{k+1}}(x;q),\] that is, the generating function \(F_{b_1b_2\cdots b_k}(x;q)\) can be written as a linear combination of the terms of the generating functions \(F_{c_1c_2\cdots c_s}(x;q)\) with \(s\leq k+1\).

For example, let \(f(\pi_1\pi_2\cdots\pi_n)=0\) if there exists \(1\leq i\leq n-1\) such that \(\pi_{i+1}\prec \pi_i\), and let \(f(\pi_1\pi_2\cdots\pi_n)=|\{i\mid \pi_i=\pi_{i+1}\}|\) otherwise. So, by the definitions, we have \[\begin{aligned} F(x;q)&=1+xF_0(x;q)+xF_1(x;q),\\ F_0(x;q)&=1+xF_{00}(x;q)+xF_{01}(x;q)=1+qxF_0(x;q)+xF_{1}(x;q),\\ F_1(x;q)&=1+xF_{11}(x;q)+xF_{12}(x;q)=1+qxF_1(x;q)+xF_{12}(x;q),\\ F_{12}(x;q)&=1+xF_{122}(x;q)+xF_{123}(x;q)=1+qxF_{12}(x;q)+xF_{123}(x;q). \end{aligned}\]

In general, \[\begin{aligned} F(x;q)&=1+xF_0(x;q)+xF_1(x;q),\\ F_0(x;q)&=1+qxF_0(x;q)+xF_{1}(x;q),\\ F_{12\cdots m}(x;q)&=1+qxF_{12\cdots m}(x;q)+xF_{12\cdots m+1}(x;q). \end{aligned}\]

In order to solve this system of recurrence relations, we write \[F_{12\cdots m}(x;q)=\frac{1}{1-qx}+\frac{x}{1-qx}F_{12\cdots m+1}(x;q).\]

By iterating (here we assume that \(|x|<1\)), we obtain \[F_{12\cdots m}(x;q)=\sum\limits_{j\geq m}\frac{x^{j-m}}{(1-qx)^{j+1-m}}=\frac{1}{1-(q+1)x}.\]

Hence, \(F_1(x;q)=\frac{1}{1-(q+1)x}\), which leads to \[\begin{aligned} F(x;q)&=1+xF_0(x;q)+xF_1(x;q),\\ F_0(x;q)&=1+qxF_0(x;q)+xF_{1}(x;q),\\ F_1(x;q)&=\frac{1}{1-(q+1)x}. \end{aligned}\]

By solving for \(F(x;q)\), we obtain that the generating function for the number of RG-words of type \(B\) in \(\mathcal{R}^B\) according to the statistic \(f\) is given by \[\begin{aligned} F(x;q)=\frac{1-(q-1)x}{1-(q+1)x}=1+\sum\limits_{n\geq1}2(q+1)^{n-1}x^n. \end{aligned}\]

In the next sections, we use the scanning-elements algorithm for solving harder problems on statistics on RG-words of type \(B\), namely, level, ascent, descent statistic.

3. Counting RG-words of type \(B\) according to the number of levels

In this section, we present explicit formulas for the generating functions for the number of RG-words of type \(B\) according to the number of levels of first, second, third, and fourth kind. Then, we derive the exponential generating function for the total of each of these statistics over all RG-words of type \(B\).

Define \[F(x;Q)=F(x;q_1,q_2,q_3,q_4)=\sum\limits_{n\geq0}x^n\sum\limits_{\pi\in{{\mathcal R}_n^B}}\prod_{j=1}^4q_j^{f_j(\pi)},\] where \(f_j(\pi)\) is the number of levels of the \(j\)th kind in \(\pi\). By the scanning-element algorithm, we have

\[\begin{aligned} F(x;Q)=&1+xF_0(x;Q)+xA_1(x;Q), \end{aligned}\tag{2}\]
\[\begin{aligned} F_0(x;Q)=&1+q_1xF_0(x;Q)+xA_1(x;Q), \end{aligned}\tag{3}\]
\[\begin{aligned} A_m(x;Q)=&1+x\sum\limits_{j=0}^{m-1}C_{m,j}(x;Q)+x\sum\limits_{j=1}^{m-1}D_{m,j}(x;Q)\\ &+q_1xA_m(x;Q)+q_2xB_m(x;Q)+xA_{m+1}(x;Q), \end{aligned}\tag{4}\]
\[\begin{aligned} B_m(x;Q)=&1+x\sum\limits_{j=0}^{m-1}C_{m,j}(x;Q)+x\sum\limits_{j=1}^{m-1}D_{m,j}(x;Q)\\ &+q_3xA_m(x;Q)+q_4xB_m(x;Q)+xA_{m+1}(x;Q), \end{aligned}\tag{5}\]
\[\begin{aligned} C_{m,0}(x;Q)=&1+x\sum\limits_{j=1}^{m-1}C_{m,j}(x;Q)+q_1xC_{m,0}(x;Q)+x\sum\limits_{j=1}^{m-1}D_{m,j}(x;Q)\\ &+xA_m(x;Q)+xB_m(x;Q)+xA_{m+1}(x;Q), \end{aligned}\tag{6}\]
\[\begin{aligned} C_{m,j}(x;Q)=&1+x\sum\limits_{j=0}^{m-1}C_{m,j}(x;Q)+x(q_1-1)C_{m,j}(x;Q)+x\sum\limits_{j=1}^{m-1}D_{m,j}(x;Q)\\ &+x(q_2-1)D_{m,j}(x;Q)+xA_m(x;Q)+xB_m(x;Q)+xA_{m+1}(x;Q), \end{aligned}\tag{7}\]
\[\begin{aligned} D_{m,j}(x;Q)=&1+x\sum\limits_{j=0}^{m-1}C_{m,j}(x;Q)+x(q_3-1)C_{m,j}(x;Q)+x\sum\limits_{j=1}^{m-1}D_{m,j}(x;Q)\\ &+x(q_4-1)D_{m,j}(x;Q)+xA_m(x;Q)+xB_m(x;Q)+xA_{m+1}(x;Q), \end{aligned}\tag{8}\]

where \(A_m(x;Q)=F_{12\cdots m}(x;Q)\), \(B_m(x;Q)=F_{12\cdots(m-1)(-m)}(x;Q)\), \(C_{m;j}(x;Q)=F_{12\cdots mj}(x;Q)\), and \(D_{m,j}(x;Q)=F_{12\cdots m(-j)}(x;Q)\).

Lemma 3.1. The solution of the system of the recurrence relations (4)(8) is the same solution of the following system \[\begin{aligned} B_m(x;Q)&=\left(1+\frac{(q_3+q_4-q_1-q_2)x}{1+(q_2-q_4)x}\right)A_m(x;Q),\\ C_{m,0}(x;Q)&=\frac{ (q_1q_4-q_2q_3+q_2+q_3-q_1-q_4)x^2+(2-q_1-q_4)x+1}{(1-(q_1-1)x)(1+(q_2-q_4)x)}A_m(x;Q),\\ C_{m,j}(x;Q)&=A_m(x;Q),\\ D_{m,j}(x;Q)&=\left(1+\frac{(q_3+q_4-q_1-q_2)x}{1+(q_2-q_4)x}\right)A_m(x;Q), \end{aligned}\] where \(A_m(x;Q)\) satisfies the following recurrence relation \[\alpha_m A_m(x;Q)=1 + \frac{x}{1-q_1x} + x\left(1+\frac{x}{1-q_1x} \right) A_{m+1}(x;Q),\] where \(\alpha_m= 1-x(2m-2+q_1+q_2)+\frac{ m((q_1+q_4-q_2-q_3)x-2)x^2}{(1+(q_2-q_4)x)(1-q_1x)} -\frac{(m-1+q_2)(q_3+q_4-q_1-q_2)x^2}{1+(q_2-q_4)x}\).

Proof. By substituting the expressions of \(B_m(x;Q)\), \(C_{m,0}(x;Q)\), \(C_{m,j}(x;Q)\), and \(D_{m,j}(x;Q)\) in each of (4)(8), we obtain the following relation \[\alpha_m A_m(x;Q)=1 + \frac{x}{1-q_1x} + x\left(1+\frac{x}{1-q_1x} \right) A_{m+1}(x;Q),\] which completes the proof. \(\square\)

By iterating (we assume \(|x|<1\)) the recurrence relation of \(A_m(x;Q)\) in the statement of Lemma 3.1, we obtain \[A_m(x;Q)=\sum\limits_{j\geq m}\frac{x^{j-m}(1+(1-q_1)x)^{j+1-m}}{(1-q_1x)^{j+1-m}\prod_{i=m}^j\alpha_i}.\]

Hence, by (2) and (3), we obtain the following result.

Theorem 3.2. The ordinary generating function for the number of all RG-words of type \(B\) in \(\mathcal{R}^B\) according to the statistics \(f_1\), \(f_2\), \(f_3\), and \(f_4\) is given by \[F(x;q_1,q_2,q_3,q_4)=\sum\limits_{j\geq0} \frac{x^j(1+(1-q_1)x)^{j+1}}{(1-q_1x)^{j+1}\prod_{i=1}^j\alpha_i},\] where \(\alpha_m= 1-x(2m-2+q_1+q_2)+\frac{ m((q_1+q_4-q_2-q_3)x-2)x^2}{(1+(q_2-q_4)x)(1-q_1x)} -\frac{(m-1+q_2)(q_3+q_4-q_1-q_2)x^2}{1+(q_2-q_4)x}\).

For instance, the Taylor’s expansion of \(F(x;q_1,q_2,q_3,q_4)\) is given by \[1+2x+(2q_1+q_2+3)x^2+(2q_1^2+q_1q_2+q_2q_3+q_2q_4+6q_1+4q_2+9)x^3+\cdots.\]

Note that (1) there are \(2\) RG-words of type \(B\) of length \(1\) in \(\mathcal{R}^B\), namely \(0\) and \(1\); (2) there are \(6\) RG-words of type \(B\) of length \(2\) in \(\mathcal{R}^B\), namely \(00\), \(01\), \(10\), \(1(-1)\), \(11\), and \(12\), which are weighted by \(q_1\), \(1\), \(1\), \(q_2\), \(q_1\), and \(1\), respectively; (3) there are \(24\) RG-words of type \(B\) of length \(3\) in \(\mathcal{R}^B\), namely \(000\), \(001\), \(010\), \(01(-1)\), \(011\), \(012\), \(100\), \(10(-1)\), \(101\), \(102\), \(1(-1)0\), \(1(-1)(-1)\), \(1(-1)1\), \(1(-1)2\), \(110\), \(11(-1)\), \(111\), \(112\), \(120\), \(12(-1)\), \(121\), \(12(-2)\), \(122\), and \(123\), which are weighted by \(q_1^2\), \(q_1\), \(1\), \(q_2\), \(q_1\), \(1\), \(q_1\), \(1\), \(1\), \(1\), \(q_2\), \(q_2q_4\), \(q_2q_3\), \(q_2\), \(q_1\), \(q_1q_2\), \(q_1^2\), \(q_1\), \(1\), \(1\), \(1\), \(q_2\), \(q_1\), and \(1\), respectively, which agrees with the coefficient of \(x^j\) in \(F(x;q_1,q_2,q_3,q_4)\), for all \(j=0,1,2\).

In the next sections, we focus on one statistic only.

3.1. The statistic \(f_1\): Number subwords \(aa\) with \(a\geq0\)

By Theorem 3.2, we have \[H(x;q):=F(x;q,1,1,1)=(1+(1-q)x)\sum\limits_{j\geq0} \frac{x^j}{\prod_{i=0}^j(1-(2i+q)x+i(q-1)x^2)},\] which implies \[F(x;1)=\sum\limits_{j\geq0}\frac{x^j}{\prod_{i=0}^j\left(1-(2i+1)x\right)}.\]

As showed in [2, Theorem 4.1]. By differentiating the generating function \(H(x;q)\) at \(q=1\), we obtain

\[H'(x)=\frac{\partial}{\partial q}H(x;q)|_{q=1}=-xN_0+\frac{x}{2}(N_1+N_0)+\frac{x(1+x)}{2}M_1,\tag{9}\]

where \[N_a=\sum\limits_{j\geq0}\frac{j^ax^j}{\prod_{i=0}^j(1-(2i+1)x)},\qquad M_a=\sum\limits_{j\geq0}\frac{x^j}{\prod_{i=0}^j(1-(2i+1)x)}\sum\limits_{i=0}^j\frac{i^a}{1-(2i+1)x}.\]

In order to find the corresponding exponential generating functions for the ordinary generating functions \(H'(x)\) \(M_a(x)\), and \(N_a(x)\), we state the following lemma.

Lemma 3.3. The corresponding exponential generating function for \(N_a\) is given by \[\tilde{N}_a=\sum\limits_{j\geq0}\frac{j^a}{2^jj!}(e^{2x}-1)^je^x.\]

In particular, \[\begin{aligned} \tilde{N}_0&=e^{x+(e^{2x}-1)/2},&&\tilde{N}_1=\frac{1}{2}(e^{2x}-1)e^{x+(e^{2x}-1)/2},\\ \tilde{N}_2&=\frac{1}{4}(e^{4x}-1)e^{x+(e^{2x}-1)/2},&&\tilde{N}_3=\frac{1}{8}(e^{2x}-1)(e^{4x}+4e^{2x}-1)e^{x+(e^{2x}-1)/2}. \end{aligned}\]

Moreover, the corresponding exponential generating function for \(M_a\) satisfies \[\tilde{M}_a=-\frac{1}{2a}\sum\limits_{k=0}^{a-1}\binom{a}{k}B_k\frac{d}{dx}\tilde{N}_{a+1-k} +\frac{1}{2}\frac{d}{dx}\tilde{M}_{a-1}-\frac{1}{2}\tilde{M}_{a-1}.\]

In particular, \[\begin{aligned} \tilde{M}_0&=e^{x+(e^{2x}-1)/2}(1+x+xe^{2x}),\\ \tilde{M}_1&=\frac{1}{4}(2xe^{4x}-e^{4x}+6xe^{2x}+1)e^{x+(e^{2x}-1)/2},\\ \tilde{M}_2&=\frac{1}{16}e^{x+(e^{2x}-1)/2} ((4x-3)e^{6x}+(28x-11)e^{4x}+(24x+11)e^{2x}+3),\\ \tilde{M}_3&=\frac{1}{96}e^{x+(e^{2x}-1)/2} \biggl((12x-11)e^{8x}+(156x-101)e^{6x}+(408x-69)e^{4x}\\ &\qquad+(144x+173)e^{2x}+8\biggr). \end{aligned}\]

Proof. By partial fraction decomposition, the generating function can be written as \[N_a=\sum\limits_{j\geq0}\frac{j^a}{2^jj!}\sum\limits_{k=0}^j\frac{(-1)^{k-j}\binom{j}{k}}{1-(2j+1)x}.\]

Thus, the corresponding exponential generating function for \(N_a\) is given by \[\tilde{N}_a=\sum\limits_{j\geq0}\frac{j^a}{2^jj!}(e^{2x}-1)^je^x.\]

Note that by [2, Theorem 4.2], we have that \(\tilde{N}_0(x)=e^{x+(e^{2x}-1)/2}\). Now, let us consider the generating function \(M_0\). It is not hard to see that \(x\frac{d}{dx}N_0(x)=-N_0(x)+M_0(x)\). Thus, the corresponding exponential generating function satisfies \[\tilde{M_0}=\tilde{N_0}+x\frac{d}{dx}\tilde{N_0}(x) =e^{x+(e^{2x}-1)/2}(1+x+xe^{2x}).\]

Let \(a\geq1\). By rewriting the generating function \(M_a\), we have \[M_a=\frac{1}{2x}\sum\limits_{j\geq0}\frac{x^j}{\prod_{i=0}^j(1-(2i+1)x)} \sum\limits_{i=0}^j\left(-i^{a-1}+\frac{i^{a-1}}{1-(2i+1)x}\right) -\frac{1}{2}M_{a-1},\] which implies \[M_a=\frac{1}{2x}\left(-\sum\limits_{j\geq0}\frac{x^j}{\prod_{i=0}^j(1-(2i+1)x)} \sum\limits_{i=0}^ji^{a-1}+M_{a-1}\right) -\frac{1}{2}M_{a-1}.\]

By the fact that (see [7]) \[\sum\limits_{i=0}^ji^{a-1}=\frac{1}{a}\sum\limits_{k=0}^{a-1}\binom{a}{k}B_kj^{a+1-k},\] where \(B_k\) is the \(k\)th Bernoulli number, we obtain \[M_a=-\frac{1}{2ax}\sum\limits_{k=0}^{a-1}\binom{a}{k}B_kN_{a+1-k}+\frac{1-x}{2x}M_{a-1}.\]

Thus, the corresponding exponential generating function for \(M_a\) satisfies \[\tilde{M}_a=-\frac{1}{2a}\sum\limits_{k=0}^{a-1}\binom{a}{k}B_k\frac{d}{dx}\tilde{N}_{a+1-k} +\frac{1}{2}\frac{d}{dx}\tilde{M}_{a-1}-\frac{1}{2}\tilde{M}_{a-1}.\] as required. \(\square\)

Thus, by (9) and Lemma 3.3, we obtain the following result.

Theorem 3.4. The exponential generating function for the total number of levels of the first kind over all \(RG\)-words of type \(B\) is given by \[\int_0^x\left(\frac{x}{2}-1\right)e^{t+(e^{2t}-1)/2}dx+\frac{1+2x}{4}e^{x+(e^{2x}-1)/2}.\]

3.2. The statistic \(f_2\): Number subwords \(a(-a)\) with \(a\geq1\)

By Theorem 3.2, we have \[H(x;q)=F(x;1,q,1,1)=\sum\limits_{j\geq0} \frac{x^j(1+(q-1)x)^j}{\prod_{i=0}^j(1-(2i+1)x-i(q-1)x^2)}.\] By differentiating the generating function \(H(x;q)\) at \(q=1\), we obtain \[\begin{aligned} H'(x)&=\frac{\partial}{\partial q}F(x;1,q,1,1)|_{q=1}\\ &=\sum\limits_{j\geq0} \frac{jx^{j+1}}{\prod_{i=0}^j(1-(2i+1)x)} +\sum\limits_{j\geq0} \frac{x^j}{\prod_{i=0}^j(1-(2i+1)x)}\sum\limits_{i=0}^j\frac{ix^2}{1-(2i+1)x}\\ &=xN_1+x^2M_1, \end{aligned}\] which, by Lemma 3.3, leads to the following result.

Theorem 3.5. The exponential generating function for the total number of levels of the second kind over all \(RG\)-words of type \(B\) is given by \[\int_0^x\frac{e^{2t}-3-2t}{4}e^{t+(e^{2t}-1)/2}dt +\frac{x}{2}e^{x+(e^{2x}-1)/2}.\]

3.3. The statistic \(f_3\): Number subwords \((-a)a\) with \(a\geq1\)

By Theorem 3.2, we have \[H(x;q)=F(x;1,1,q,1)=\sum\limits_{j\geq0} \frac{x^j}{\prod_{i=0}^j(1-(2i+1)x+i(q-1)x^2)}.\]

By differentiating the generating function \(H(x;q)\) at \(q=1\), we obtain \[\begin{aligned} H'(x)&=\frac{\partial}{\partial q}F(x;1,1,q,1)|_{q=1}\\ &=\sum\limits_{j\geq0} \frac{x^j}{\prod_{i=0}^j(1-(2i+1)x)}\sum\limits_{i=0}^j\frac{ix^2}{1-(2i+1)x} =x^2N_1(x), \end{aligned}\] which, by Lemma 3.3, leads to the following result.

Theorem 3.6. The exponential generating function for the total number of levels of the third kind over all \(RG\)-words of type \(B\) is given by \[\frac{1}{4}+\frac{2x-1}{4}e^{x+(e^{2x}-1)/2} -\frac{1}{2}\int_0^xte^{t+(e^{2t}-1)/2}dt.\]

3.4. The statistic \(f_4\): Number subwords \((-a)(-a)\) with \(a\geq1\)

By Theorem 3.2, we have \[H(x;q)=F(x;1,1,1,q)=\sum\limits_{j\geq0} \frac{x^j(1+(1-q)x)^{j+1}}{\prod_{i=0}^j(1-(2i+q)x-(1-q)(i+1)x^2)}.\]

By differentiating the generating function \(H(x;q)\) at \(q=1\), we obtain \[H'(x)=\frac{\partial}{\partial q}F(x;1,1,1,q)=\sum\limits_{j\geq0} \frac{x^j}{\prod_{i=0}^j(1-(2i+1)x)}\sum\limits_{i=0}^j\frac{ix^2}{1-(2i+1)x}=x^2N_1,\] which, by Lemma 3.3, leads to the following result.

Theorem 3.7. The exponential generating function for the total number of levels of the fourth kind over all \(RG\)-words of type \(B\) is given by \[\frac{1}{4}+\frac{2x-1}{4}e^{x+(e^{2x}-1)/2} -\frac{1}{2}\int_0^xte^{t+(e^{2t}-1)/2}dt.\]

We end this section, by stating the following results, where we omit the proofs since the similarity to the previous four subsections. An absolute level in a word \(\pi_1\pi_2\cdots \pi_n\) is an index \(1\leq i\leq n-1\) such that \(|\pi_i|=|\pi_{i+1}|\). So, the number of absolute levels in a RG-word \(\pi\) of type \(B\) is the same as the number of subwords \(aa\), \(a(-a)\), \((-a)a\), and \((-a)(-a)\) in \(\pi\). Thus, by Theorem 3.2 with \(q_1=q_2=q_3=q_4=q\), we obtain the following result.

Theorem 3.8. The ordinary generating function for the number of all RG-words of type \(B\) according to number of absolute levels (counts by \(q\)) is given by \[\frac{1-(q-1)x}{1-xq}\sum\limits_{j\geq0}\frac{x^j}{\prod_{i=1}^j\left(\frac{1-(q-2)x}{1-(q-1)x}-2(q+i)x\right)}.\]

Moreover, the exponential generating function for the total number of the absolute levels over all RG-words of type \(B\) is given by \[\int_0^x\int_0^te^{t+(e^{2r}-1)/2}drdx+e^x\int_0^x\int_0^te^{-t+3r+(e^{2r}-1)/2}(2re^{2r}+5r+2)drdt.\]

A level in a word \(\pi_1\pi_2\cdots \pi_n\) is an index \(1\leq i\leq n-1\) such that \(\pi_i=\pi_{i+1}\). So, the number of levels in a RG-word \(\pi\) of type \(B\) is the same as the number of subwords \(aa\) and \((-a)(-a)\) in \(\pi\). Thus, by Theorem 3.2 with \(q_1=q_4=q\) and \(q_2=q_3=1\), we obtain the following result.

Theorem 3.9. The ordinary generating function for the number of all RG-words of type \(B\) according to number of levels (counts by \(q\)) is given by \[F(x;q)=(1-(q-1)x)\sum\limits_{j\geq0}\frac{x^j}{\prod_{i=0}^j(1-(2i+q)x)}.\]

Moreover, the exponential generating function for the number of all RG-words of type \(B\) according to number of levels (counts by \(q\)) is given by \[e^{qx+(e^{2x}-1)/2}-(q-1)\int_0^xe^{qt+(e^{2t}-1)/2}.\]

4. Counting RG-words of type \(B\) according to the number of ascents

In this section, we present explicit formulas for the generating functions for the number of RG-words of type \(B\) according to the number of ascents of first, second, third, and fourth kind. Then, we derive the ordinary generating function for the total of each of these statistic over all RG-words of type \(B\).

Define \[F(x;Q)=F(x;q_1,q_2,q_3,q_4)=\sum\limits_{n\geq0}x^n\sum\limits_{\pi\in{{\mathcal R}_n^B}}\prod_{j=1}^4q_j^{f_j(\pi)},\] where \(f_j(\pi)\) is the number of ascents of the \(j\)th kind in \(\pi\). By the scanning-element algorithm, we have

\[\begin{aligned} F(x;Q)=&1+xF_0(x;Q)+xA_1(x;Q), \end{aligned}\tag{10}\]
\[\begin{aligned} F_0(x;Q)=&1+xF_0(x;Q)+q_1xA_1(x;Q), \end{aligned}\tag{11}\]
\[\begin{aligned} A_1(x;Q)=&1+xC_{1,0}(x;Q)+xA_1(x;Q)+xB_1(x,Q)+xA_2(x;Q), \end{aligned}\tag{12}\]
\[\begin{aligned} B_1(x;Q)=&1+xC_{1,0}(x;Q)+q_3xA_1(x;Q)+xB_1(x;Q)+\frac{q_3}{q_1}xA_2(x;Q), \end{aligned}\tag{13}\]
\[\begin{aligned} C_{1,0}(x;Q)=&1+xC_{1,0}(x;Q)+q_1xA_1(x;Q)+q_2xB_1(x;Q)+xA_2(x;Q), \end{aligned}\tag{14}\]
\[\begin{aligned} A_m(x;Q)=&q_1^{m-1}+x\sum\limits_{j=0}^{m-1}C_{m,j}(x;Q)+x\sum\limits_{j=1}^{m-1}D_{m,j}(x;Q)\\ &+xA_m(x;Q)+\frac{q_1}{q_2}xB_m(x;Q)+xA_{m+1}(x;Q), \end{aligned}\tag{15}\]
\[\begin{aligned} B_m(x;Q)=&q_1^{m-2}q_2+\frac{q_2}{q_1}x\sum\limits_{j=0}^{m-1}C_{m,j}(x;Q)+\frac{q_2}{q_1}x\sum\limits_{j=1}^{m-1}D_{m,j}(x;Q)\\ &+\frac{q_2q_3}{q_1}xA_m(x;Q)+xB_m(x;Q)+\frac{q_2q_3}{q_1^2}xA_{m+1}(x;Q), \end{aligned}\tag{16}\]
\[\begin{aligned} C_{m,j}(x;Q)=&q_1^{m-1}+x\sum\limits_{i=0}^jC_{m,i}(x;Q)+q_1x\sum\limits_{i=j+1}^{m-1}C_{m,i}(x;Q)\\ &+x\sum\limits_{i=1}^jD_{m,i}(x;Q)+q_2x\sum\limits_{i=j+1}^{m-1}D_{m,i}(x;Q)\\ &+q_1xA_m(x;Q)+q_1xB_m(x;Q)+xA_{m+1}(x;Q), \end{aligned}\tag{17}\]
\[\begin{aligned} D_{m,j}(x;Q)=&q_1^{m-1}+x\sum\limits_{i=0}^{j-1}C_{m,i}(x;Q)+q_3x\sum\limits_{i=j}^{m-1}C_{m,i}(x;Q)\\ &+x\sum\limits_{i=1}^jD_{m,i}(x;Q)+q_4x\sum\limits_{i=j+1}^{m-1}D_{m,i}(x;Q)\\ &+q_3xA_m(x;Q)+\frac{q_1q_4}{q_2}xB_m(x;Q)+\frac{q_3}{q_1}xA_{m+1}(x;Q), \end{aligned}\tag{18}\]

where \(A_m(x;Q)=F_{12\cdots m}(x;Q)\), \(B_m(x;Q)=F_{12\cdots(m-1)(-m)}(x;Q)\), \(C_{m;j}(x;Q)=F_{12\cdots mj}(x;Q)\), and \(D_{m,j}(x;Q)=F_{12\cdots m(-j)}(x;Q)\). Since the solution is complex, we consider only once statistic at once.

4.1. Ascents of first kind

In this case, (10)(18) with \(q_1=q\) and \(q_2=q_3=q_4=1\) is equivalent to the following recurrences \[\begin{aligned} F(x;Q)&=1+xF_0(x;Q)+xA_1(x;Q),\\ F_0(x;Q)&=1+xF_0(x;Q)+qxA_1(x;Q),\\ A_1(x;Q)&=\frac{1+xB_1(x;Q)+xA_2(x;Q)}{1-x(2+(q-1)x)},\\ A_m(x;Q)&=\frac{q^{m-1}+mqxB_m(x;Q)+xA_{m+1}(x;Q)}{1-x-(1+(q-1)x)((1+(q-1)x)^m-1)/(q-1)},\\ B_1(x;Q)&=\frac{1+x(2+(q-1)x)A_1(x;Q)+\frac{1}{q}xA_2(x;Q)}{1-x},\\ B_m(x;Q)&=\frac{q^{m-2}+\frac{(1+(q-1)x)^{m+1}-1}{q(q-1)}A_m(x;Q)+\frac{1}{q^2}xA_{m+1}(x;Q)}{1-mx},\\ C_{m,j}(x;Q)&=(1+(q-1)x)^{m-j}A_m(x;Q),\\ D_{m,j}(x;Q)&=qB_m(x;Q). \end{aligned}\]

Therefore, \[\begin{aligned} A_1(x;Q)=&\frac{1}{1-3x+(1-q)x^2}+\frac{x((1-q)x+q)}{q(1-3x+(1-q)x^2)}A_2(x;Q),\\ A_m(x;Q)=&\frac{(1-q)q^{m-1}}{(q-1)mx-q+(1+(q-1)x)^{m+1}}\\ &+\frac{x(1-q)(mx(1-q)+q)}{q((q-1)mx-q+(1+(q-1)x)^{m+1})}A_{m+1}(x;Q), \end{aligned}\] for all \(m\geq2\). Hence, by iterating (here we assume \(|x|<1\)), we have \[A_2(x;Q)=q\sum\limits_{j\geq2} \frac{(1-q)^{j-1}x^{j-2}\prod_{i=2}^{j-1}((1-q)ix+q)}{\prod_{i=2}^j((q-1)ix-q+(1+(q-1)x)^{i+1})}.\]

Thus, \[\begin{aligned} A_1(x;Q)&=\sum\limits_{j\geq1} \frac{(1-q)^jx^{j-1}\prod_{i=1}^{j-1}((1-q)ix+q)}{\prod_{i=1}^j((q-1)ix-q+(1+(q-1)x)^{i+1})}. \end{aligned}\]

By (10) and (11), we have the following result.

Theorem 4.1. The ordinary generating function for the number of all RG-words of type \(B\) according to number of ascents of first kind (counts by \(q\)) is given by \[\begin{aligned} F(x;q,1,1,1)&=\frac{1}{1-x}+(1+(q-1)x)\sum\limits_{j\geq1} \frac{(1-q)^{j+1}x^j\prod_{i=1}^{j-1}((1-q)ix+q)}{\prod_{i=0}^j((q-1)ix-q+(1+(q-1)x)^{i+1})}, \end{aligned}\]

By differentiating at \(q=1\), we obtain that the ordinary generating function for the total number of ascents of first kind over all RG-words of type \(B\) is given by \[\begin{aligned} &\sum\limits_{j\geq1}\frac{x^j}{\prod_{i=0}^j(1-(2i+1)x)} \left(x+ \sum\limits_{i=1}^{j-1}(1-ix) +x^2\sum\limits_{i=0}^j\frac{\binom{i+1}{2}}{(1-(2i+1)x)}\right)\\ &\qquad=xN_0+N_1-N_0+1-\frac{x}{2}N_2+\frac{x}{2}N_1+\frac{x^2}{2}(M_2+M_1). \end{aligned}\]

Thus, by Lemma 3.3, we obtain the following result.

Corollary 4.2. The exponential generating function for the total number of ascents of first kind over all RG-words of type \(B\) is given by \[\begin{aligned} &\frac{1}{32}\int_{0}^{x}e^{t+(e^{2t}-1)/2}(35+(4t-7)e^{4t}+ 4(4t+1)e^{2t}) dt + \frac{1}{2} e^{x+(e^{2x}-1)/2}(e^{2x}-3)+ 1. \end{aligned}\]

4.2. Ascents of second kind

In this case, (10)(18) with \(q_2=q\) and \(q_1=q_3=q_4=1\) is equivalent to the following recurrences \[\begin{aligned} F(x;Q)&=1+xF_0(x;Q)+xA_1(x;Q),\\ F_0(x;Q)&=1+xF_0(x;Q)+xA_1(x;Q),\\ A_1(x;Q)&=\frac{1+xA_2(x;Q)}{1-x(3+(q-1)x)},\\ A_m(x;Q)&=\frac{1+xA_{m+1}(x;Q)}{1-x(\binom{m+1}{2}(q-1)x+2m+1)},\\ B_1(x;Q)&=A_1(x;Q),\\ B_m(x;Q)&=qA_m(x;Q),\\ C_{m,j}(x;Q)&=(1+(m-j)(q-1)x)A_m(x;Q),\\ D_{m,j}(x;Q)&=A_m(x;Q). \end{aligned}\]

Therefore, \[\begin{aligned} A_1(x;Q)&=\frac{1+xA_2(x;Q)}{1-x(3+(q-1)x)},\\ A_m(x;Q)&=\frac{1+xA_{m+1}(x;Q)}{1-x(\binom{m+1}{2}(q-1)x+2m+1)}, \end{aligned}\] for all \(m\geq2\). Hence, by iterating (here we assume \(|x|<1\)), we have \[A_2(x;Q)=\sum\limits_{j\geq2}\frac{x^{j-2}}{\prod_{i=2}^j(1-x(\binom{i+1}{2}(q-1)x+2i+1))},\] which implies \[A_1(x;Q)=\sum\limits_{j\geq1}\frac{x^{j-1}}{\prod_{i=1}^j(1-x(\binom{i+1}{2}(q-1)x+2i+1))}.\]

By the equations of \(F(x;Q)\) and \(F_0(x;Q)\), we have the following result.

Theorem 4.3. The ordinary generating function for the number of all RG-words of type \(B\) according to number of ascents of second kind (counts by \(q\)) is given by \[\begin{aligned} F(x;1,q,1,1)&=\sum\limits_{j\geq0}\frac{x^{j}}{\prod_{i=0}^j(1-x(\binom{i+1}{2}(q-1)x+2i+1))}. \end{aligned}\]

By differentiating at \(q=1\), we obtain that the ordinary generating function for the total number of ascents of second kind over all RG-words of type \(B\) is given by \[\begin{aligned} \sum\limits_{j\geq0}\frac{x^{j}}{\prod_{i=0}^j(1-(2i+1)x)} \sum\limits_{i=0}^j\frac{\binom{i+1}{2}x^2}{1-(2i+1)x}=\frac{x^2}{2}(M_2+M_1), \end{aligned}\] which, by Lemma 3.3, implies the following result.

Corollary 4.4. The exponential generating function for the total number of ascents of second kind over all RG-words of type \(B\) is given by \[\begin{aligned} \frac{1}{32}\int_0^xe^{t+(e^{2t}-1)/2}((4t-3)e^{4t}+4(4t-1)e^{2t}+7)dt. \end{aligned}\]

4.3. Ascents of third kind

In this case, (10)(18) with \(q_3=q\) and \(q_1=q_2=q_4=1\) is equivalent to the following recurrences \[\begin{aligned} F(x;Q)&=1+xF_0(x;Q)+xA_1(x;Q),\\ F_0(x;Q)&=1+xF_0(x;Q)+xA_1(x;Q),\\ A_m(x;Q)&=\frac{1+x(1+(q-1)mx)A_{m+1}(x;Q)}{1-x(\binom{m+1}{2}(q-1)x+2m+1)},\\ B_m(x;Q)&=(1-x(1-q))A_m(x;Q)-x(1-q)A_{m+1}(x;Q),\\ C_{m,j}(x;Q)&=A_m(x;Q),\\ D_{m,j}(x;Q)&=(1+(q-1)x(m+1-j))A_m(x;Q)+(q-1)xA_{m+1}(x;Q). \end{aligned}\]

Therefore, by iterating (here we assume \(|x|<1\)), we have \[A_1(x;Q)=\sum\limits_{j\geq1}\frac{x^{j-1}\prod_{i=1}^{j-1}(1+x(q-1)ix)}{ \prod_{i=1}^j(1-x(\binom{i+1}{2}(q-1)x+2i+1))}.\]

By the equations of \(F(x;Q)\) and \(F_0(x;Q)\), we have the following result.

Theorem 4.5. The ordinary generating function for the number of all RG-words of type \(B\) according to number of ascents of third kind (counts by \(q\)) is given by \[\begin{aligned} F(x;1,1,q,1)&=\sum\limits_{j\geq0}\frac{x^j\prod_{i=0}^{j-1}(1+(q-1)ix)}{ \prod_{i=0}^j(1-x(\binom{i+1}{2}(q-1)x+2i+1))}. \end{aligned}\]

By differentiating at \(q=1\), we obtain that the ordinary generating function for the total number of ascents of third kind over all RG-words of type \(B\) is given by \[\begin{aligned} \sum\limits_{j\geq0}\frac{x^{j}}{\prod_{i=0}^j(1-(2i+1)x)} \left(\sum\limits_{i=0}^{j-1}ix+\sum\limits_{i=0}^j\frac{\binom{i+1}{2}x^2}{1-(2i+1)x}\right) =\frac{x}{2}(N_2-N_1)+\frac{x^2}{2}(M_2+M_1), \end{aligned}\] which, by Lemma 3.3, the following result.

Corollary 4.6. The exponential generating function for the total number of ascents of third kind over all RG-words of type \(B\) is given by \[\begin{aligned} \frac{1}{32}\int_0^xe^{t+(e^{2t}-1)/2}((4t+1)e^{4t}+4(4t-3)e^{2t}+11)dt. \end{aligned}\]

4.4. Ascents of fourth kind

In this case, (10)(18) with \(q_4=q\) and \(q_1=q_2=q_3=1\) is equivalent to the following recurrences \[\begin{aligned} F(x;Q)&=1+xF_0(x;Q)+xA_1(x;Q),\\ F_0(x;Q)&=1+xF_0(x;Q)+xA_1(x;Q),\\ A_m(x;Q)&=\frac{1+xA_{m+1}(x;Q)}{1-x(\frac{(1+(q-1)x)^m-1}{(q-1)x}+m+1)},\\ B_m(x;Q)&=C_{m,j}(x;Q)=A_m(x;Q),\\ D_{m,j}(x;Q)&=(1+(q-1)x)^{m-j}A_m(x;Q). \end{aligned}\]

Therefore, by iterating (here we assume \(|x|<1\)), we have \[A_1(x;Q)=\sum\limits_{j\geq1}\frac{x^{j-1}}{\prod_{i=1}^j (\frac{q-(1+(q-1)x)^i}{q-1}-(i+1)x)}.\]

By the equations of \(F(x;Q)\) and \(F_0(x;Q)\), we have the following result.

Theorem 4.7. The ordinary generating function for the number of all RG-words of type \(B\) according to number of ascents of third kind (counts by \(q\)) is given by \[\begin{aligned} F(x;1,1,1,q)&=\sum\limits_{j\geq0}\frac{x^j}{\prod_{i=0}^j (\frac{q-(1+(q-1)x)^i}{q-1}-(i+1)x)}. \end{aligned}\]

By differentiating at \(q=1\), we obtain that the ordinary generating function for the total number of ascents of third kind over all RG-words of type \(B\) is given by \[\begin{aligned} \sum\limits_{j\geq0}\frac{x^{j}}{\prod_{i=0}^j(1-(2i+1)x)} \sum\limits_{i=0}^j\frac{\binom{i}{2}x^2}{1-(2i+1)x}=\frac{x^2}{2}(M_2-M_1). \end{aligned}\] which, by Lemma 3.3, implies the following result.

Corollary 4.8. The exponential generating function for the total number of ascents of third kind over all RG-words of type \(B\) is given by \[\begin{aligned} \frac{1}{32}\int_0^xe^{t+(e^{2t}-1)/2}((4t-3)e^{4t}+4e^{2t}-1)dt. \end{aligned}\]

4.5. Absolute ascents

An absolute ascent in a word \(\pi_1\pi_2\cdots \pi_n\) is an index \(1\leq i\leq n-1\) such that \(|\pi_i|<|\pi_{i+1}|\). Then, as before, (10)(18) with \(q_1=q_2=q_3=q_4=q\) gives \[\begin{aligned} \left(1+\frac{1-(1+(q-1)x)(1+2(q-1)x)^m}{q-1}\right)A_m(x;q) &=q^{m-1}+xA_{m+1}(x;q). \end{aligned}\]

Hence, by iterating (here we assume that \(|x|<1\)), we have \[A_1(x;q)=\sum\limits_{j\geq1}\frac{x^{j-1}q^{j-1}}{\prod_{i=1}^j\left(1+\frac{1-(1+(q-1)x)(1+2(q-1)x)^i}{q-1}\right)},\] which leads to the following result.

Theorem 4.9. The ordinary generating function for the number of all RG-words of type \(B\) in \(\mathcal{R}^B\) according to number of absolute ascents (counts by \(q\)) is given by \[\frac{1}{1-x}+(1+(q-1)x)\sum\limits_{j\geq1} \frac{x^jq^{j-1}}{\prod_{i=0}^j\left(1+\frac{1-(1+(q-1)x)(1+2(q-1)x)^i}{q-1}\right)}.\]

By differentiating at \(q=1\), we obtain that the ordinary generating function for the total number of absolute ascents over all RG-words of type \(B\) is given by \[\begin{aligned} &x\sum\limits_{j\geq1}\frac{x^j}{\prod_{i=0}^j(1-(2i+1)x)} +\sum\limits_{j\geq1}\frac{(j-1)x^j}{\prod_{i=0}^j(1-(2i+1)x)}\\ &+\sum\limits_{j\geq1}\frac{x^j}{\prod_{i=0}^j(1-(2i+1)x)} \sum\limits_{i=0}^j\frac{2i^2x^2}{1-(2i+1)x}\\ &=xN_0+N_1-N_0+1+2x^2M_2, \end{aligned}\] which, by Lemma 3.3, implies the following result.

Corollary 4.10. The exponential generating function for the total number of absolute ascents over all RG-words of type \(B\) is given by \[\begin{aligned} \frac{1}{8}\int_0^xe^{t+(e^{2t}-1)/2}((4t-3)e^{4t}+8e^{2t}+11)dt +\frac{1}{2}e^{x+(e^{2x}-1)/2}(e^{2x}-3)+1. \end{aligned}\]

5. Counting RG-words of type \(B\) according to the number of descents

In this section, we present explicit formulas for the generating functions for the number of RG-words of type \(B\) according to the number of descents of first, second, third, and fourth kind. Then, we derive the ordinary generating function for the total of each of these statistic over all RG-words of type \(B\).

Define \[F(x;Q)=F(x;q_1,q_2,q_3,q_4)=\sum\limits_{n\geq0}x^n\sum\limits_{\pi\in{{\mathcal R}_n^B}} \prod_{j=1}^4q_j^{f_j(\pi)},\] where \(f_j(\pi)\) is the number of descents of the \(j\)th kind in \(\pi\). By the scanning-element algorithm, we have

\[\begin{aligned} F(x;Q)=&1+xF_0(x;Q)+xA_1(x;Q), \end{aligned}\tag{19}\]
\[\begin{aligned} F_0(x;Q)=&1+xF_0(x;Q)+xA_1(x;Q), \end{aligned}\tag{20}\]
\[\begin{aligned} A_m(x;Q)=&1+x\sum\limits_{j=0}^{m-1}C_{m,j}(x;Q)+x\sum\limits_{j=1}^{m-1}D_{m,j}(x;Q)\\ &+xA_m(x;Q)+q_2xB_m(x;Q)+xA_{m+1}(x;Q), \end{aligned}\tag{21}\]
\[\begin{aligned} B_m(x;Q)=&1+\frac{q_3}{q_1}x\sum\limits_{j=0}^{m-1}C_{m,j}(x;Q)+\frac{q_4}{q_2}x\sum\limits_{j=1}^{m-1}D_{m,j}(x;Q)\\ &+xA_m(x;Q)+xB_m(x;Q)+xA_{m+1}(x;Q), \end{aligned}\tag{22}\]
\[\begin{aligned} C_{m,j}(x;Q)=&q_1+q_1x\sum\limits_{i=0}^{j-1}C_{m,i}(x;Q)+x\sum\limits_{i=j}^{m-1}C_{m,i}(x;Q)\\ &+q_1x\sum\limits_{i=1}^jD_{m,i}(x;Q)+\frac{q_1}{q_2}x\sum\limits_{i=j+1}^{m-1}D_{m,i}(x;Q)\\ &+q_1xA_m(x;Q)+q_1xB_m(x;Q)+q_1xA_{m+1}(x;Q), \end{aligned}\tag{23}\]
\[\begin{aligned} D_{m,j}(x;Q)=&q_2+\frac{q_2q_3}{q_1}x\sum\limits_{i=0}^{j-1}C_{m,i}(x;Q)+\frac{q_2}{q_1}x\sum\limits_{i=j}^{m-1}C_{m,i}(x;Q)\\ &+q_4x\sum\limits_{i=1}^{j-1}D_{m,i}(x;Q)+x\sum\limits_{i=j}^{m-1}D_{m,i}(x;Q)\\ &+q_2xA_m(x;Q)+q_2xB_m(x;Q)+q_2xA_{m+1}(x;Q), \end{aligned}\tag{24}\]

where \(A_m(x;Q)=F_{12\cdots m}(x;Q)\), \(B_m(x;Q)=F_{12\cdots(m-1)(-m)}(x;Q)\), \(C_{m;j}(x;Q)=F_{12\cdots mj}(x;Q)\), and \(D_{m,j}(x;Q)=F_{12\cdots m(-j)}(x;Q)\). Since the complexity of the solution, we consider only one statistic at once.

As in the previous sections (here we omit the proofs), we obtain the following results.

Theorem 5.1. The ordinary generating function for the number of all RG-words of type \(B\) according to number of descents of first kind (counts by \(q\)) is given by \[\begin{aligned} F(x;q,1,1,1)=&\sum\limits_{j\geq0}\frac{x^j}{\prod_{i=0}^j\left(\frac{1}{1-q}-x-\frac{ix(1-q)+q}{(1-q)(1-(1-q)x)^i}\right)}. \end{aligned}\]

Moreover, the ordinary generating function for the total number of descents of the first kind over all RG-words of type \(B\) is given by \[\begin{aligned} \sum\limits_{j\geq0}\frac{x^j}{\prod_{i=0}^j(1-(2i+1)x)}\sum\limits_{i=0}^j\frac{ix(2-(3i+1)x)}{2(1-(2i+1)x)}, \end{aligned}\] and the exponential generating function for the total number of descents of the first kind over all RG-words of type \(B\) is given by \[\begin{aligned} \frac{1}{4}e^{x+(e^{2x}-1)/2}((2x-1)e^{2x}+1) -\frac{1}{32}\int_0^xe^{t+(e^{2t}-1)/2} ((12t-9)e^{4t}+(32t-4)e^{2t}+13)dt. \end{aligned}\]

Theorem 5.2. The ordinary generating function for the number of all RG-words of type \(B\) according to number of descents of second kind (counts by \(q\)) is given by \[\begin{aligned} F(x;1,q,1,1)=&\sum\limits_{j\geq0}\frac{x^j}{\prod_{i=0}^j\left(1-(2i+1)x+\frac{ix(1-q)(2-(3i+1)x)}{2(1+i(q-1)x)}\right)}. \end{aligned}\]

Moreover, the ordinary generating function for the total number of descents of the second kind over all RG-words of type \(B\) is given by \[\begin{aligned} \sum\limits_{j\geq0}\frac{x^j}{\prod_{i=0}^j(1-(2i+1)x)}\sum\limits_{i=0}^j\frac{ix(2-(3i+1)x)}{2(1-(2i+1)x)}, \end{aligned}\] and the exponential generating function for the total number of descents of the second kind over all RG-words of type \(B\) is given by \[\begin{aligned} \frac{1}{4}e^{x+(e^{2x}-1)/2}((2x-1)e^{2x}+1) -\frac{1}{32}\int_0^xe^{t+(e^{2t}-1)/2} ((12t-9)e^{4t}+(32t-4)e^{2t}+13)dt. \end{aligned}\]

Theorem 5.3. The ordinary generating function for the number of all RG-words of type \(B\) according to number of descents of third kind (counts by \(q\)) is given by \[\begin{aligned} F(x;1,1,q,1)=&\sum\limits_{j\geq0}\frac{x^j}{\prod_{i=0}^j\left(1-(2i+1)x+x^2(1-q)\binom{i+1}{2}\right)}. \end{aligned}\]

Moreover, the ordinary generating function for the total number of descents of the third kind over all RG-words of type \(B\) is given by \[\begin{aligned} \sum\limits_{j\geq0}\frac{x^j}{\prod_{i=0}^j(1-(2i+1)x)}\sum\limits_{i=0}^j\frac{\binom{i+1}{2}x^2}{1-(2i+1)x}, \end{aligned}\] and the exponential generating function for the total number of descents of the third kind over all RG-words of type \(B\) is given by \[\begin{aligned} \frac{1}{32}\int_0^xe^{t+(e^{2t}-1)/2}((4t-3)e^{4t}+4(4t-1)e^{2t}+7)dt. \end{aligned}\]

Theorem 5.4. The ordinary generating function for the number of all RG-words of type \(B\) according to number of descents of fourth kind (counts by \(q\)) is given by \[\begin{aligned} F(x;1,1,1,q)=&\sum\limits_{j\geq0}\frac{x^j}{\prod_{i=0}^j\left(1-(i+1)x+\frac{1-(qx-x+1)^i}{q-1}\right)}. \end{aligned}\]

Moreover, the ordinary generating function for the total number of descents of the fourth kind over all RG-words of type \(B\) is given by \[\begin{aligned} \sum\limits_{j\geq0}\frac{x^j}{\prod_{i=0}^j(1-(2i+1)x)}\sum\limits_{i=0}^j\frac{\binom{i}{2}x^2}{1-(2i+1)x}, \end{aligned}\] and the exponential generating function for the total number of descents of the fourth kind over all RG-words of type \(B\) is given by \[\begin{aligned} \frac{1}{32}\int_0^xe^{t+(e^{2t}-1)/2}((4t-3)e^{4t}+4e^{2t}-1)dt. \end{aligned}\]

An absolute descent in a word \(\pi_1\pi_2\cdots \pi_n\) is an index \(1\leq i\leq n-1\) such that \(|\pi_{i+1}|<|\pi_i|\).

Theorem 5.5. The ordinary generating function for the number of all RG-words of type \(B\) according to number of absolute descents (counts by \(q\)) is given by \[\frac{1}{1-x} \sum\limits_{j\geq0}\frac{x^j}{\prod_{i=1}^j\left(\frac{q}{(q-1)(1+(q-1)x)(1+2(q-1)x)^{i-1}}-\frac{1}{q-1} -2x\right)}.\]

Moreover, the ordinary generating function for the total number of absolute descents over all RG-words of type \(B\) is given by \[\sum\limits_{j\geq 0}\frac{x^j}{\prod_{i=0}^j(1-(2i+1)x)}\sum\limits_{i=0}^j\frac{x(2i-1+x(1-2i^2))}{1-(2i+1)x},\] and the exponential generating function for the total number of absolute descents over all RG-words of type \(B\) is given by \[\frac{1}{8}\int_0^xe^{t+(e^{2t}-1)/2}((4t-1)e^{4t}+8te^{2t}+1)dt.\]

A descent in a word \(\pi_1\pi_2\cdots \pi_n\) is an index \(1\leq i\leq n-1\) such that \(\pi_{i+1}\prec\pi_i\).

Theorem 5.6. The ordinary generating function for the number of all RG-words of type \(B\) according to number of descents (counts by \(q\)) is given by \[\sum\limits_{j\geq0}\frac{x^j}{\prod_{i=0}^j\left(1-x-\frac{q(1-(1+(q-1)x)^{-2i})}{q-1}\right)}.\]

Moreover, the ordinary generating function for the total number of descents over all RG-words of type \(B\) is given by \[\sum\limits_{j\geq0}\frac{x^j}{\prod_{i=0}^j(1-(2i+1)x)}\sum\limits_{i=0}^j\frac{ix(2-2ix-x)}{1-(2i+1)x},\] and the exponential generating function for the total number of descents over all RG-words of type \(B\) is given by \[\frac{1}{8}\int_0^xe^{t+(e^{2t}-1)/2}((4t-1)e^{4t}+2(6t+1)te^{2t}-1)dt.\]

References:

  1. E. Bagno, D. Garber, and T. Komatsu. A \(q,r\)-analogue for the stirling numbers of the second kind of coxeter groups of type \(B\). Pure Mathematics and Applications, 30(1):8–16, 2022. https://doi.org/10.2478/puma-2022-0003.
  2. E. Bagno, D. Garber, T. Mansour, and A. Safadi. Pattern avoidance and Schur-positivity in restricted-growth words of type \(B\). Discrete Applied Mathematics, 386:116–138, 2026. https://doi.org/10.1016/j.dam.2026.01.020.
  3. I. Dolgachev and V. Lunts. A character formula for the representation of a Weyl group in the cohomology of the associated toric variety. Journal of Algebra, 168(3):741–772, 1994. https://doi.org/10.1006/jabr.1994.1251.
  4. G. Firro and T. Mansour. Three-letter-pattern avoiding permutations and functional equations. The Electronic Journal of Combinatorics, 13(1), R51, 2006. https://doi.org/10.37236/1077.
  5. A. M. Goyt and L. K. Pudwell. Avoiding colored partitions of lengths two and three. Pure Mathematics and Applications, 22(2):107–128, 2011.
  6. A. M. Goyt and L. K. Pudwell. Avoiding colored partitions of two elements in the pattern sense. Journal of Integer Sequences, 15(6), 12.6.2, 2012.
  7. R. L. Graham, D. E. Knuth, and O. Patashnik. Concrete Mathematics: A Foundation for Computer Science. Addison-Wesley, Reading, MA, 2nd edition, 1994.
  8. T. Mansour. Combinatorics of Set Partitions. Discrete Mathematics and Its Applications. Chapman and Hall/CRC, Boca Raton, FL, 2012. https://doi.org/10.1201/b12691.
  9. T. Mansour and A. O. Munagi. Enumeration of partitions by long rises, levels, and descents. Journal of Integer Sequences, 12(1), 09.1.8, 2009.
  10. T. Mansour and A. O. Munagi. Enumeration of partitions by rises, levels and descents. In S. Linton, N. Ruškuc, and V. Vatter, editors, Permutation Patterns: St Andrews 2007. Volume 376, London Mathematical Society Lecture Note Series, pages 221–232. Cambridge University Press, Cambridge, 2010. https://doi.org/10.1017/CBO9780511902499.012.
  11. T. Mansour and M. Shattuck. Counting peaks and valleys in a partition of a set. Journal of Integer Sequences, 13(6), https://doi.org/10.6.8, 2010.
  12. T. Mansour, M. Shattuck, and S. H. F. Yan. Counting subwords in a partition of a set. The Electronic Journal of Combinatorics, 17(1), R19, 2010. https://doi.org/10.37236/291.
  13. V. Reiner. Non-crossing partitions for classical reflection groups. Discrete Mathematics, 177(1–3):195–222, 1997. https://doi.org/10.1016/S0012-365X(96)00365-2.
  14. M. Shattuck. Recounting the number of rises, levels, and descents in finite set partitions. Integers, 10:179–185, A13, 2010.