1 Introduction

As has become common practice in many recent papers, integer compositions of n with k parts are modelled by a bargraph with k columns in which the ith part, say \(x_i\), is represented by column i of height \(x_i\) in the bargraph. In these papers, each column is made up of vertically stacked square cells. In a large part of what follows, we replace each such cell by a small circular node located at the centre of each such square and we now consider this to be the bargraph representation of the integer composition. We position the sun at infinity in the north west and consider the problem of how many of the nodes representing the composition are lit by the sun (and hence also how many are in the shade). In the case of square cells, the idea of such lit cells has been studied before (see [2]) in the paradigm of words over a fixed alphabet k.

Fig. 1
figure 1

Square cell and circular node representations of 4+2+1+1+3

In Figs. 1 and 2 below the number of lit objects differ. In particular the lower right square cell of Fig. 1 is not lit because its edges are blocked by adjacent cells, but the lower right circular node is lit. Thus the determination of various counting functions may be distinct combinatorial problems for the two representations. In the rest of the paper we distinguish clearly between the (circular) node situation and the (square) cell situation.

Another way the pattern of lit cells can differ in the two representations is shown in Fig. 2. In general the width of the cells in the square cell representation may shade cells in later columns that would have been lit as circular nodes, so we expect cumulative lit node counts to eventually exceed cumulative lit cell counts.

Fig. 2
figure 2

Another case with different lit nodes and cells

Following the very creative idea of Prodinger in [8], this problem can be simplified as follows: we consider the bijection specified below which maps each composition of n with j parts to the super-diagonal (or skew, in Prodinger’s terms) composition of \(n+\left( {\begin{array}{c}j-1\\ 2\end{array}}\right) \). This bijection is defined by mapping each original ith part \(x_i\) to the new ith part \(x_i+i-1\) (and the ith part is mapped to \(x_i-i+1\) for the inverse). The simplifying modification is that we now consider the image composition to be lit by light coming from the sun on the western horizon, and the number of such lit nodes in the image composition is the same as the number of lit nodes in the original composition (when lit by the sun at infinity in the north west direction). Moreover, this number is simply given by the largest part that occurs in the image composition. This is all very nicely explained by Prodinger in the introduction to [8], and we recommend this paper to the reader. For an illustration of this, see Fig. 3. Other papers dealing with skew or super-diagonal bargraphs are found in [4] and [9]. A super-diagonal composition is one in which the ith part is greater than or equal to i.

In Sect. 2, we obtain the generating function for the number of lit nodes in an integer composition of n and in Sect. 3 we modify this to obtain the generating function for the number of lit square cells. In Sect. 4 we turn our attention to lit columns which leads naturally to Sect. 5 in which case only the first column is lit. In Sect. 6, we prove in Proposition 16 that the generating function for the compositions in which only the first column is lit is the same as the generating function for compositions in which the first part is strictly smallest. To the authors it appears a remarkable fact that the proof of this proposition relies essentially on a partition theory identity found as detailed later in [1]. That a research question in the context of integer compositions relies essentially on the field of integer partitions is what surprised us. This Proposition has many interesting identities as corollaries and these are also given in Sect. 6. These identities allow us to deduce the asymptotics for both the number of lit nodes and columns as \(n \rightarrow \infty \) in a simple way. The latter is presented in the final Sect. 7.

Fig. 3
figure 3

4+2+1+1+3 skewed to give 4+3+3+4+7. Note that the largest part is 7, which is the number of lit nodes in Fig. 1

2 Generating functions for lit nodes in integer compositions

To begin, we let k be any positive integer and we consider those compositions of n for which all parts are less than or equal to k after applying the bijection defined in the introduction. This means that the ith part of the original integer composition of n satisfies \(x_i+i-1\le k\) or \(x_i\le k+1-i\). Next we consider such compositions of n that have j parts and we define a bivariate generating function \(f_{k,j}(x,q)\) in which q tracks the size of the original composition n; x tracks the size of the image compositions under the bijection defined and as already stated, j is the number of parts in the original (pre-bijection) compositions of n and k is the maximum allowed size of the parts of the image compositions As stated in the introduction, the number of lit nodes in a composition of n is k if and only if the maximum part of its image composition is k. This is obtained from the generating function \(f_{k,j}(x,q)-f_{k-1,j}(x,q)\) below. To reiterate, \(f_{k,j}(x,q)-f_{k-1,j}(x,q)\) is the generating function for those compositions of n tracked by q, with j parts which have a largest part of size k in the image composition. It simultaneously gives the image composition whose size is tracked by x, or equivalently, it is the generating function for the original compositions of n which have precisely k lit nodes.

Thus we obtain the following proposition

Proposition 1

The generating function \(f_{k,j}\) is given by

$$\begin{aligned} f_{k,j}(x,q)=\frac{x^{ j (j-1)/2} q^j x^j \prod _{i=1}^k \left( 1-q^i x^i\right) }{(1-q x)^j \prod _{i=1}^{k-j} \left( 1-q^i x^i\right) }. \end{aligned}$$
(1)

Proof

Initially, we wish to find a generating function for the ith part \(x_i\) of the original composition of n which when raised in the bijection described has a maximum value of k. The possible values for this part are \(1, 2,\ldots , k-i+1\) with generating function after being raised by \(i-1\) of \(x^{i-1}\left( (xq)+(xq)^2+\ldots (xq)^{k-i+1}\right) =x^{i-1} \frac{(xq)-(xq)^{k-i+2}}{1-xq} \). For all j parts of the original composition we obtain

$$\begin{aligned} x^{j(j-1)/2}\prod _{i=1}^j \frac{(xq)-(xq)^{k-i+2}}{1-xq}=\frac{x^{ j (j-1)/2} q^j x^j \prod _{i=1}^k \left( 1-q^i x^i\right) }{(1-q x)^j \prod _{i=1}^{k-j} \left( 1-q^i x^i\right) }. \end{aligned}$$

\(\square \)

Next, we define \(f_{k}(x,q):=\sum _{j=1}^kf_{k,j}(x,q)\) which has the same meaning as \(f_{k,j}\) except that the number of parts in the original integer compositions is no longer fixed.

As stated in the introduction, the number of lit nodes in a composition of n is k if and only if the maximum part of its image composition is k. This is obtained from the generating function \(F_k(x,q):=f_{k}(x,q)-f_{k-1}(x,q)\). To reiterate, \(F_k(x,q)\) is the generating function for those compositions of n tracked by q which have a largest part of size k in the image composition whose size is tracked by x, or equivalently, it is the generating function for those compositions of n which have precisely k lit nodes.

Thus, we obtain the corollary.

Corollary 2

The generating function \(F_k\) is given by

$$\begin{aligned} F_k(x,q)=&\frac{x^{\frac{1}{2} k (k-1)} q^k x^k}{(1-q x)^k}\prod _{i=1}^k \left( 1-q^i x^i\right) \nonumber \\ {}&+\sum _{j=1}^{k-1} \frac{x^{\frac{1}{2} j (j-1)} q^j x^j}{(1-q x)^j}\frac{\prod _{i=1}^{k-1} \left( 1-q^i x^i\right) }{\prod _{i=1}^{k-j-1} \left( 1-q^i x^i\right) }\left( \frac{1-q^k x^k}{1-q^{k-j} x^{k-j}}-1\right) \end{aligned}$$
(2)

Proof

By definition of \(F_k\) and using Eq. (1),

$$\begin{aligned} F_k(x,q){} & {} =\sum _{j=1}^k \frac{x^{\frac{1}{2} j (j-1)} q^j x^j}{(1-q x)^j}\frac{\prod _{i=1}^k \left( 1-q^i x^i\right) }{\prod _{i=1}^{k-j} \left( 1-q^i x^i\right) }\nonumber \\{} & {} \quad -\sum _{j=1}^{k-1} \frac{x^{\frac{1}{2} j (j-1)} q^j x^j}{(1-q x)^j}\frac{\prod _{i=1}^{k-1} \left( 1-q^i x^i\right) }{\prod _{i=1}^{k-1-j} \left( 1-q^i x^i\right) } \end{aligned}$$
(3)

which simplifies as per the proposition statement. \(\square \)

We define our final generating function \(F(x,q,u):=\sum _{k=1}^\infty F_k(x,q)u^k\) in which u tracks the number of lit nodes in compositions of n tracked by q.

From this we find \(G(q):=\frac{\partial F(1,q,u)}{\partial u}\big |_{u=1}\) which is the generating function for the total number of lit nodes in compositions of n, and so we have our first result:

Proposition 3

The generating function for the total number of lit nodes in compositions of n which is tracked by the variable q is given by

$$\begin{aligned} G(q)&= \sum _{k=1}^{\infty } k q^k \left( \prod _{i=1}^k \left( 1-q^i\right) \right) \left( \frac{1}{(1-q)^k}+\frac{1}{1-q^k}\sum _{j=1}^{k-1} \frac{1-q^j}{(1-q)^j}\frac{1}{\prod _{i=1}^{k-j} \left( 1-q^i\right) }\right) . \end{aligned}$$
(4)

The series expansion for G(q) begins

$$\begin{aligned}{} & {} q+4 q^2+11 q^3+28 q^4+66 q^5+152 q^6+341 q^7+754 q^8+1648 q^9+3571 q^{10}\\{} & {} \quad +7682 q^{11}. \end{aligned}$$

Note that none of these series expansions appear in the OEIS ( [10]) unless otherwise specified.

Via the image of the bijection in Sect. 1, we have also simultaneously been studying the heights of superdiagonal bargraphs. The associated generating function is given in the following proposition. Letting \(q=1\) in Eq. (2), and summing on k, we obtain

Proposition 4

The coefficient of \(x^n\) in the generating function below is the sum of the maximal part sizes in superdiagonal compositions of n.

$$\begin{aligned} \sum _{k=1}^{\infty } k \left( \frac{x^{\frac{1}{2} k (k+1)}}{(1-x)^k}\prod _{i=1}^k \left( 1-x^i\right) +\sum _{j=1}^{k-1} \frac{x^{\frac{1}{2} j (j+1)}}{(1-x)^j}\frac{\prod _{i=1}^{k-1} \left( 1-x^i\right) }{\prod _{i=1}^{k-j-1} \left( 1-x^i\right) }\left( \frac{1-x^k}{1-x^{k-j}}-1\right) \right) . \end{aligned}$$
(5)

The series for this begins

$$\begin{aligned}{} & {} x+2 x^2+5 x^3+9 x^4+15 x^5+25 x^6+41 x^7+64 x^8+97 x^9+145 x^{10}\\{} & {} \quad +215 x^{11}+316 x^{12}. \end{aligned}$$

There is also an alternative way to derive an expression for G(q) that is simpler than that of Proposition 3 but depends on a later calculation found in Corollary 11.

We obtain:

Theorem 5

The generating function for the total number of lit nodes in compositions of n which is tracked by the variable q is given by

$$\begin{aligned} G(q)&=\frac{(1-q) q}{(1-2 q)^2}+\frac{1}{1-2 q}\sum _{j=1}^{\infty } q^j\sum _{m=1}^j \frac{q^m}{(1-q)^{m-1}}\prod _{r=2}^m \left( 1-q^{j+1-r}\right) . \end{aligned}$$
(6)

Proof

Let a(n) be the number of lit nodes in compositions of n. As explained in [3], we can obtain all the compositions of \(n+1\) from those of n using a two case process:

  1. 1.

    Prepending a 1 to any composition of n.

  2. 2.

    Increasing the first part of any composition of n by 1.

These two processes are disjoint from each other.

Case 1 increases the number of lit nodes by 1 and so contributes \(a(n)+2^{n-1}\) to \(a(n+1)\).

Case 2 means that an extra node is lit in column 1. If there is a subsequent column which is partially shaded by column 1, then one extra node in this column is shaded and overall there is no change to the total number of lit nodes. The cases where we add a lit node is when all further parts are in the shade of the first column. We therefore wish to count the number of cases where only the first column is lit. The generating function for these cases in which only the first column is lit is found later in Eq. (17):

$$\begin{aligned} B(q):=\sum _{n=1}^{\infty } b(n) q^n=\sum _{j=1}^{\infty } q^j \sum _{m=1}^j \frac{q^{m-1}}{(1-q)^{m-1}}\prod _{r=2}^m \left( 1-q^{j+1-r}\right) \end{aligned}$$

as given in Eq. (17). We also let \(G(q)=\sum _{n=1}^\infty a(n)q^n\). The contribution from Step 2 is \(a(n)+b(n)\).

Altogether

$$\begin{aligned} a(n+1)=2a(n)+2^{n-1}+b(n). \end{aligned}$$

Multiplying by \(q^{n+1}\) and summing over n, we obtain

$$\begin{aligned} G(q)-a(1) q=q \left( 2 G(q)+\frac{q}{1-2 q}+B(q)\right) \end{aligned}$$

and hence

$$\begin{aligned} G(q)=\frac{(1-q) q}{(1-2 q)^2}+\frac{q B(q)}{1-2 q}. \end{aligned}$$

\(\square \)

3 Generating functions for lit square cells in integer compositions

As per the section title, we now consider compositions of n modeled by bargraphs in which the rth part of size \(x_r\) is represented by the rth column of a bargraph composed of \(x_r\) square cells rather than \(x_r\) circular nodes as in previous sections. In this case we define a cell to be shaded (unlit) if it has at most a single point on its boundary that is lit. (Such a point would be the leftmost top point). To explain this a little further, suppose that the image composition has two successive left to right maxima \(s<t\) which are respectively in positions \(i<j\). As explained in the introduction, the top \(t-s\) nodes in column j of the image composition are lit by light from the western horizon. Using the reverse bijection from Sect. 1, we investigate whether in the domain composition, any of these are shaded from north west light in the cellular model. The position in the domain composition immediately to the left of the lowest of the lit nodes in column j is either occupied by a node (see for example Fig. 1) or is already in the shade (see Fig. 2), because if this were not so, there would be an additional node lit from the west below the \(t-s\) nodes of the image composition in column j, violating the assumption that the number of such nodes is \(t-s\). This has the following consequence. If \(t-s=1\), in the jth column of the domain composition only the top boundary of the top cell is lit in which case the number of lit cells or nodes is equal for this column. On the other hand if \(t-s \ge 2\) then the left boundary of the bottom left lit cell is shaded and the top boundary of this cell is shaded by the cell above it with consequence that there is one less shaded cell when compared to shaded nodes. So to count the cells which are shaded when the corresponding node is lit, we need to count the number of left to right maxima in the image compositions which exceed the previous maximum by two or more.

To achieve this, as already indicated we let two successive left-to-right maxima of the image composition be \(s,s+p\) in positions ij respectively. Since we only wish to track such maxima which differ by two or more, we have that \(p \ge 2\). We use the variables xq to track the respective sizes in the generating function for the image and domain compositions under the bijection defined in Sect. 1. After position j, we also track the domain and image for an arbitrary composition with \(m \ge 0\) parts. For all parts up to the jth position we express the generating function where the coefficient of \(x^k\) is the number of successive left-to right maxima in positions i and j in the image composition of size k as

$$\begin{aligned}{} & {} \left( \frac{x-x^s}{1-x}\frac{x^2-x^s}{1-x}\cdots \frac{x^{i-1}-x^s}{1-x}\right) x^s\left( \frac{x^{i+1}-x^{s+1}}{1-x}\frac{x^{i+2}-x^{s+1}}{1-x}\right. \\{} & {} \quad \left. \cdots \frac{x^{j-1}-x^{s+1}}{1-x}\right) x^{s+p}\frac{1}{q^{\frac{1}{2} j (j-1)}}. \end{aligned}$$

After using product notation, simplifying the above and taking account of the arbitrary composition which may occur after the jth position, we obtain the generating function where the coefficient of \(x^k\) again tracks the number of adjacent pairs of left-to right maxima in positions ij as

$$\begin{aligned} \underbrace{\frac{1}{(1-x q)^{j-2}}\prod _{r=1}^{j-2} \left( (x q)^r-(x q)^s\right) \frac{(x q)^{2 s+p} (x q)^{j-1-i}}{q^{\frac{1}{2} j (j-1)}}} \times&\nonumber \\ \times \underbrace{\left( 1+\sum _{m=1}^{\infty } \frac{1}{q^{j m+\frac{1}{2} m (m-1)}}\frac{1}{(1-x q)^m}\prod _{r=1}^m (x q)^{j+r}\right) }, \end{aligned}$$
(7)

where the first underbrace above is the generating function for the first j parts of our compositions and the second underbrace captures the rest.

For the full generating function, we allow ijsp and m to vary through the full range of possible values as shown in the sums below:

$$\begin{aligned} G_1(q,x):=\sum _{i=1}^{\infty } \sum _{j=i+1}^{\infty } \sum _{s=i}^{\infty } \sum _{p=2}^{\infty }&\frac{1}{(1-x q)^{j-2}}\prod _{r=1}^{j-2} \left( (x q)^r-(x q)^s\right) \frac{(x q)^{2 s+p} (x q)^{j-1-i}}{q^{\frac{1}{2} j (j-1)}} \nonumber \\ {}&\times \left( 1+\sum _{m=1}^{\infty } \frac{1}{q^{j m+\frac{1}{2} m (m-1)}}\frac{1}{(1-x q)^m}\prod _{r=1}^m (x q)^{j+r}\right) . \end{aligned}$$
(8)

This simplifies to

$$\begin{aligned} G_1(q,x)=\sum _{i=1}^{\infty } \sum _{j=i+1}^{\infty } \sum _{s=i}^{\infty } \sum _{p=2}^{\infty }&\frac{q^{-\frac{1}{2} (-1+j) j} (q x)^{\frac{1}{2} \left( -2 i-j+j^2+2 p+4 s\right) }}{(1-x q)^{j-2}}\prod _{r=1}^{j-2} \left( 1-(x q)^{s-r}\right) \nonumber \\ {}&\times \left( 1+\sum _{m=1}^{\infty } \frac{q^m x^{\frac{1}{2} m (1+2 j+m)}}{(1-x q)^m}\right) . \end{aligned}$$
(9)

Next we let \(x=1\) and obtain our next

Proposition 6

The generating function for the number of cells which are shaded from north west light in the cellular model but are lit in the nodal model is given by

$$\begin{aligned} G_1(q,1)&=\frac{1}{1-2 q}\sum _{j=1}^{\infty } \sum _{s=1}^{\infty } \frac{q^{3+2 s-j} \left( 1-q^{j-1}\right) }{(1-q)^{j-1}}\prod _{r=1}^{j-2} \left( 1-q^{s-r}\right) . \end{aligned}$$
(10)

And so using Eq. (4), the generating function \(G_2(q)=G(q)-G_1(q,1)\) for all lit cells in the square cell model is given in the following theorem:

Theorem 7

The generating function for the total number of lit cells in compositions of n tracked by the variable q in the square cell model is given by

$$\begin{aligned} G_2(q)=&\frac{(1-q) q}{(1-2 q)^2}+\frac{1}{1-2 q}\sum _{j=1}^{\infty } q^j\sum _{m=1}^j \frac{q^m}{(1-q)^{m-1}}\prod _{r=2}^m \left( 1-q^{j+1-r}\right) \nonumber \\ {}&-\frac{1}{1-2 q}\sum _{j=1}^{\infty } \sum _{s=1}^{\infty } \frac{q^{3+2 s-j} \left( 1-q^{j-1}\right) }{(1-q)^{j-1}}\prod _{r=1}^{j-2} \left( 1-q^{s-r}\right) . \end{aligned}$$
(11)

The series expansion \(G_2(q)\) begins

$$\begin{aligned}{} & {} q+4 q^2+10 q^3+25 q^4+57 q^5+130 q^6+287 q^7+629 q^8+1363 q^9+2933 q^{10}\\{} & {} \quad +6271 q^{11}+13346 q^{12}. \end{aligned}$$

4 Lit columns of compositions

We say that a particular column of a composition is lit if the top cell of that column of the bargraph which models the composition is illuminated by the north western light. In the nodal model this means the top node is lit and in the square cell model, we define it to mean that the top boundary of the top cell is illuminated. However, by applying the bijection that was defined in the introduction, and then considering once again the image composition in both cases to be lit from the western horizon, the top cell in a part in the nodal image is lit iff the top cell in the corresponding part in the square cell model is lit. In other words, both models have the same lit and shaded parts (columns).

The aim here is to obtain a generating function for the total number of lit columns in compositions of n and since the answer is the same, we will use the nodal model in order to develop this. As already implied we use the bijection defined in the introduction and reiterate that a column of a composition is lit if that column in the image composition is lit from the western horizon. This is equivalent to the image of that part being a left to right maximum in the image composition. So we will develop a generating function which tracks the number of left to right maxima in the image of a particular composition of n.

To do this, we consider compositions that have a left to right maximum of height s in column i of the image function. We track the size n of the original composition with variable q and the size of the image composition with variable x. We reserve \(m \ge 0\) for the number of parts that come after the ith column. In the image composition, the first \(i-1\) parts each have maximum part size \(s-1\), and therefore together with the left to right maximum, a combined generating function given by

$$\begin{aligned}\prod _{r=1}^{i-1}\left( \frac{(xq)^r-(xq)^s}{1-xq}\right) (xq)^s\frac{1}{q^{i(i-1)/2}}.\end{aligned}$$

The last m parts have generating function

$$\begin{aligned}1+\sum _{m=1}^{\infty } \frac{1}{q^{i m+\frac{1}{2} m (m-1)}}\frac{1}{(1-x q)^m}\prod _{r=1}^m (x q)^{i+r}.\end{aligned}$$

Next we combine these and sum for i, s over the limits shown below. After simplification, we obtain

$$\begin{aligned} \sum _{i=1}^{\infty } \sum _{s=i}^{\infty } \frac{q^s x^{\frac{1}{2} (-1+i) i+s}}{(1-x q)^{i-1}}\prod _{r=1}^{i-1} \left( 1-(x q)^{s-r}\right) \left( 1+\sum _{m=1}^{\infty } \frac{q^m x^{\frac{1}{2} m (1+2 i+m)}}{(1-x q)^m}\right) . \end{aligned}$$
(12)

Putting \(x=1\), we obtain the following

Theorem 8

The generating function for the number of columns lit by north west light in compositions of n tracked by variable q, is given by

$$\begin{aligned} \frac{1-q}{1-2 q}\sum _{i=1}^{\infty } \sum _{s=i}^{\infty } \frac{q^s}{(1-q)^{i-1}}\prod _{r=1}^{i-1} \left( 1-q^{s-r}\right) . \end{aligned}$$
(13)

The series expansion for this begins

$$\begin{aligned}{} & {} q+3 q^2+7 q^3+17 q^4+38 q^5+86 q^6+189 q^7+413 q^8+894 q^9+1923 q^{10}\nonumber \\{} & {} \quad +4111 q^{11}+8751 q^{12}. \end{aligned}$$
(14)

On the other hand, by using Eq. (12) once again and this time setting \(q=1\), we obtain

Proposition 9

The generating function for the total number of left-to-right maxima in superdiagonal compositions whose size n is tracked by x, is given by

$$\begin{aligned} \sum _{i=1}^{\infty } \sum _{s=i}^{\infty } \frac{x^{\frac{1}{2} (-1+i) i+s}}{(1-x)^{i-1}}\left( \prod _{r=1}^{i-1} \left( 1-x^{s-r}\right) \right) \left( 1+\sum _{m=1}^{\infty } \frac{x^{\frac{1}{2} m (1+2 i+m)}}{(1-x)^m}\right) . \end{aligned}$$
(15)

The series for this begins

$$\begin{aligned} x{+}x^2{+}3 x^3{+}4 x^4+6 x^5{+}10 x^6{+}16 x^7+23 x^8+33 x^9+48 x^{10}+70 x^{11}+101 x^{12}. \end{aligned}$$

5 compositions in which only the first column is lit

Finally, we find a generating function for compositions of n in which only the first column is lit. We obtain

Proposition 10

The generating function for compositions in which only the first column is lit, is given by

$$\begin{aligned} \sum _{j=1}^{\infty } \sum _{m=1}^j \frac{1}{q^{\frac{1}{2} m (m-1)}}\frac{(x q)^j}{(1-x q)^{m-1}}\prod _{r=2}^m \left( (x q)^r-(x q)^{j+1}\right) , \end{aligned}$$
(16)

where as usual x and q track the size of the super-diagonal and ordinary compositions respectively.

Proof

The first part is of size j. In the image composition, the total number of parts is m and all are of height less than or equal to j. We sum over all the possibilites for j and m. \(\square \)

Putting \(x=1\) and then \(q=1\) into Eq. (16), we obtain the following two corollaries:

Corollary 11

The generating function for the number of compositions of n tracked by q in which only the first column is lit (by north west light) is given by

$$\begin{aligned} \sum _{j=1}^{\infty } \sum _{m=1}^j \frac{q^{m+j-1}}{(1-q)^{m-1}}\prod _{r=2}^m \left( 1-q^{j+1-r}\right) \end{aligned}$$
(17)

with series expansion beginning

$$\begin{aligned} q+q^2+2 q^3+2 q^4+4 q^5+5 q^6+8 q^7+12 q^8+19 q^9+28 q^{10}+45 q^{11}+70 q^{12}. \end{aligned}$$

And,

Corollary 12

The generating function for the number of super-diagonal compositions of n tracked by x in which the first column is (weakly) largest is given by

$$\begin{aligned} \sum _{j=1}^{\infty } \sum _{m=1}^j \frac{x^{j+\frac{1}{2} (m-1) (m+2)}}{(1-x)^{m-1}}\prod _{r=2}^m \left( 1-x^{j-r+1}\right) \end{aligned}$$
(18)

with series expansion beginning

$$\begin{aligned} x+x^2+x^3+2 x^4+2 x^5+3 x^6+3 x^7+5 x^8+6 x^9+8 x^{10}+10 x^{11}+13 x^{12}. \end{aligned}$$

6 identities

The series in Eq. (17) appears in the OEIS, [10], as sequence A079501 which is described as the number of compositions of the integer n with strictly smallest part in the first position. For example. there are 5 compositions of 6 with strictly smallest part first: {{6},{1,5},{2,4},{1,2,3},{1,3,2}}, whereas the compositions of 6 with only the first column lit are {{6},{5,1},{4,2},{4,1,1},{3,2,1}}. It turns out that some of the other light generating functions are also connected to sequences in the OEIS that are related to smallest parts in compositions. This leads to various interesting q-series identities.

6.1 Lit node identities

We remind the reader of our previous derivation of Eq. (6) in Sect. 2. The result we obtained was

$$\begin{aligned} G(q)&=\frac{(1-q) q}{(1-2 q)^2}+\frac{1}{1-2 q}\sum _{j=1}^{\infty } q^j\sum _{m=1}^j \frac{q^m}{(1-q)^{m-1}}\prod _{r=2}^m \left( 1-q^{j+1-r}\right) . \end{aligned}$$
(19)

Here G(q) is the generating function for the total number of lit nodes in compositions of n. In the results that follow, we will relate G(q) to the generating function H(q) defined in the following proposition.

Lemma 13

The following generating functions are equal. Each counts the sum of the smallest parts of compositions of n, as usual tracked by q. These are:

$$\begin{aligned} H(q){} & {} :=\sum _{k=1}^{\infty } \frac{q^k}{1-q-q^k}=(1-q)^2\sum _{k=1}^{\infty } \frac{k q^k}{1-q-q^{k+1}}\frac{1}{1-q-q^k}\nonumber \\{} & {} =\sum _{k=1}^{\infty } \frac{q^k}{(1-q)^k}\frac{1}{1-q^k}. \end{aligned}$$
(20)

Proof

We give a sketch proof of this. Consider the middle generating function. We construct a generating function for an arbitrary composition of the leftmost occurrence of the smallest part k, preceded by a possibly empty sequence with parts larger than k and followed by a possibly empty sequence of parts greater or equal to k. The sequence obtained has the form

$$\begin{aligned} \left( 1+\frac{\frac{q^{k+1}}{1-q}}{1-\frac{q^{k+1}}{1-q}}\right) q^k\left( 1+\frac{\frac{q^{k}}{1-q}}{1-\frac{q^{k}}{1-q}}\right) , \end{aligned}$$

which is the generating function for compositions with minimum part size k. So we multiply by k and sum over all k. After simplification we obtain the middle generating function.

For the first generating function, we consider instead the finite sum

$$\begin{aligned} \sum _{k=1}^{M } \left( \frac{q^k}{1-q-q^k}-\frac{q^{k+1}}{1-q-q^{k+1}}\right) k \end{aligned}$$

which counts k for each composition in which the minimum part size k actually occurs. Then we make use of the telescoping nature of this sum and let M go to infinity resulting finally in the first generating function.

Finally, for the last generating function, for each k, \(\frac{1}{1-q^k}\) is written as an infinite geometric series with sum index r, say. The order of the k and r sums are swopped. After simplification, this series is seen to be the same as the first series. \(\square \)

For the case of lit columns we will require a related identity that is similar to the first and last expressions in Lemma 13. By the same methods as above we can show

Corollary 14

The following generating functions for compositions of n with strictly smallest part first are also equivalent.

$$\begin{aligned} (1-q)\sum _{k=1}^{\infty } \frac{q^{k}}{1-q-q^{k+1}}=(1-q)\sum _{k=1}^{\infty } \frac{q^{2k-1}}{(1-q)^k}\frac{1}{1-q^k}. \end{aligned}$$
(21)

The previous Lemma and Corollary lead to the following four Propositions 15, 16, 17 and 18 whose proofs will follow from those of Propositions 19 and 21 later:

From the generating function for compositions with strictly smallest part first, which is given by the right hand side of Eq. (22), we obtain an identity from (17), namely:

Proposition 15

$$\begin{aligned} \sum _{j=1}^{\infty } \sum _{m=1}^j \frac{q^{m+j-1}}{(1-q)^{m-1}}\prod _{r=2}^m \left( 1-q^{j+1-r}\right) =\sum _{k=1}^{\infty } \frac{(1-q) q^k}{1-q-q^{k+1}}. \end{aligned}$$
(22)

In other words

Proposition 16

The number of compositions of n with only the first column lit is equal to the number of compositions of n with strictly smallest part first.

6.2 Lit column identities

Next, we consider the total number of lit columns. We initially state a further two propositions whose proofs will be given after the statements.

Proposition 17

The total number of lit columns in compositions of n is equal to the number of compositions of n which consist of a composition with weakly smallest part first followed by an arbitrary composition.

Using Theorem 8 for the left hand side, this Proposition is equivalent to the following generating function identity:

Proposition 18

$$\begin{aligned} C(q):=\frac{1-q}{1-2 q}\sum _{i=1}^{\infty } \sum _{s=i}^{\infty } \frac{q^s}{(1-q)^{i-1}}\prod _{r=1}^{i-1} \left( 1-q^{s-r}\right) = \frac{(1-q)^2}{1-2 q}\sum _{i=1}^{\infty } \frac{q^i}{1-q-q^i}, \end{aligned}$$
(23)

because as shown in paper [7] and in Lemma 13, the generating function for compositions with weakly smallest part first is

$$\begin{aligned} (1-q) \sum _{i=1}^{\infty } \frac{q^i}{1-q-q^i}. \end{aligned}$$
(24)

The statements for Eqs. (23) and (22) appear very similar, so we can rewrite these propositions as the matching Identities (25) and (34) below.

Firstly from Eq. (23), we will show

Proposition 19

$$\begin{aligned} \sum _{j=1}^{\infty } \sum _{m=1}^j \frac{q^j}{(1-q)^{m-1}}\prod _{r=1}^{m-1} \left( 1-q^{j-r}\right) =(1-q) \sum _{i=1}^{\infty } \frac{q^i}{1-q-q^i}. \end{aligned}$$
(25)

We need the following Lemma:

Lemma 20

For fixed integers \(m\ge 0\)

$$\begin{aligned} \frac{q^m}{1-q^m}\frac{1}{\prod _{r=1}^m \left( 1-q^r\right) }=\sum _{j=0}^{\infty } \frac{q^{j+m}}{1-q^{m+j}}\left( {\begin{array}{c}j+m\\ j\end{array}}\right) _q \end{aligned}$$

Proof

Both sides of the identity in (26) below count partitions into at most m parts; in the sum the summand counts those with largest part equal to j:

$$\begin{aligned} \frac{1}{\prod _{r=1}^m \left( 1-q^r\right) }=\sum _{j=0}^{\infty } \left( \left( {\begin{array}{c}j+m\\ j\end{array}}\right) _q-\left( {\begin{array}{c}j+m-1\\ j-1\end{array}}\right) _q\right) . \end{aligned}$$
(26)

By using the q-binomial recursion (10.0.3) found in [1], Eq. (26) is equivalent to Eq. (27) below.

$$\begin{aligned} \frac{1}{\prod _{r=1}^m \left( 1-q^r\right) }=\sum _{j=0}^{\infty } q^j \left( {\begin{array}{c}j+m-1\\ j\end{array}}\right) _q. \end{aligned}$$
(27)

By multiplying Eq. (27) by \(q^m/(1 - q^m)\) we obtain

$$\begin{aligned} \frac{q^m}{1-q^m}\frac{1}{\prod _{r=1}^m \left( 1-q^r\right) }=\sum _{j=0}^{\infty } \frac{q^{j+m}}{1-q^m}\left( {\begin{array}{c}j+m-1\\ j\end{array}}\right) _q. \end{aligned}$$
(28)

The right hand side of (28) is equivalent to that of the statement since

$$\begin{aligned} \left( {\begin{array}{c}j+m\\ j\end{array}}\right) _q=\frac{1-q^{m+j}}{1-q^m}\left( {\begin{array}{c}j+m-1\\ j\end{array}}\right) _q. \end{aligned}$$

\(\square \)

Next, we do the proof of Proposition 19.

Proof

Rewrite the right hand side of Eq. (25) as

$$\begin{aligned} (1-q) \sum _{i=1}^{\infty } \frac{q^i}{1-q-q^i}=(1-q) \sum _{m=1}^{\infty } \left( \frac{1}{1-q}\right) ^m\frac{q^m}{1-q^m}. \end{aligned}$$
(29)

Now, we rewrite the left hand side of Eq. (25) as

$$\begin{aligned}&(1-q) \sum _{j=1}^{\infty } \frac{q^j}{1-q^j}\sum _{m=1}^j \left( \frac{1}{1-q}\right) ^m\prod _{r=0}^{m-1} \left( 1-q^{j-r}\right) \nonumber \\&=(1-q) \sum _{m=1}^{\infty } \left( \frac{1}{1-q}\right) ^m\sum _{j=m}^{\infty } \frac{q^j}{1-q^j}\prod _{r=0}^{m-1} \left( 1-q^{j-r}\right) . \end{aligned}$$
(30)

By deleting the common factors from the right hand sides of Eqs. (29) and (30) it remains necessary to show that

$$\begin{aligned} \sum _{m=1}^{\infty } \frac{q^m}{1-q^m}=\sum _{m=1}^{\infty } \sum _{j=m}^{\infty } \frac{q^j}{1-q^j}\prod _{r=0}^{m-1} \left( 1-q^{j-r}\right) . \end{aligned}$$
(31)

In fact we will show that for each positive integer m,

$$\begin{aligned} \frac{q^m}{1-q^m}=\sum _{j=m}^{\infty } \frac{q^j}{1-q^j}\prod _{r=0}^{m-1} \left( 1-q^{j-r}\right) . \end{aligned}$$
(32)

We transform Eq. (32) into a q-binomial identity

$$\begin{aligned} \frac{q^m}{1-q^m}\frac{1}{\prod _{r=1}^m \left( 1-q^r\right) }=\sum _{j=m}^{\infty } \frac{q^j}{1-q^j}\left( {\begin{array}{c}j\\ m\end{array}}\right) _q=\sum _{j=0}^{\infty } \frac{q^{j+m}}{1-q^{j+m}}\left( {\begin{array}{c}j+m\\ m\end{array}}\right) _q. \end{aligned}$$
(33)

which is precisely what is proved in Lemma 20. \(\square \)

The companion identity to (25) comes from Eq. (22) leading to the following

Proposition 21

$$\begin{aligned} \sum _{j=1}^{\infty } \sum _{m=1}^j q^{m-1}\frac{q^j}{(1-q)^{m-1}}\prod _{r=1}^{m-1} \left( 1-q^{j-r}\right) =(1-q) \sum _{i=1}^{\infty } \frac{q^i}{1-q-q^{i+1}}. \end{aligned}$$
(34)

Proof

To prove this, we note that the left hand side of Eq. (34) looks like the left hand side of Eq. (25) after we have multiplied the summand of the latter by \(q^{m-1}\). We begin with Proposition 20, multiply both sides by \(q^{m-1}\) and then reverse the steps that led from Eq. (26) to the statement of Proposition 20, this time using Corollary 14. \(\square \)

Propositions 15, 16, 17 and 18 all follow from the above Propositions.

In view of these identities we have new simpler generating function expressions for some of the earlier results.

Corollary 22

The generating function for the number of compositions of n tracked by q in which only the first column is lit (by north west light) is given by

$$\begin{aligned} g(q):=(1-q) \sum _{i=1}^{\infty } \frac{q^i}{1-q-q^{i+1}}. \end{aligned}$$
(35)

Corollary 23

The generating function for the total number of lit nodes in compositions of n which is tracked by the variable q is given by

$$\begin{aligned} G(q)&=\frac{1-q}{1-2 q}\sum _{i=1}^{\infty } \frac{q^i}{1-q-q^i}. \end{aligned}$$
(36)

Corollary 24

The generating function for the number of columns lit by north west light in compositions of n tracked by variable q, is given by

$$\begin{aligned} C(q)=\frac{(1-q)^2}{1-2 q}\sum _{i=1}^{\infty } \frac{q^i}{1-q-q^i}=(1-q)G(q). \end{aligned}$$
(37)

Remark 25

From Eqs. (36) and (37), we infer the identity

$$\begin{aligned}G(q)=\frac{1}{1-q}C(q).\end{aligned}$$

We can interpret this remark in the following form:

Proposition 26

The total number of lit nodes in compositions of n equals the total number of lit columns in compositions of size at most n.

Remark 27

The previous Eq. (11) for lit cells can be partially simplified as

$$\begin{aligned} G_2(q)=&\frac{1-q}{1-2 q}\sum _{i=1}^{\infty } \frac{q^i}{1-q-q^i} -\frac{1}{1-2 q}\sum _{j=1}^{\infty } \sum _{s=1}^{\infty } \frac{q^{3+2 s-j} \left( 1-q^{j-1}\right) }{(1-q)^{j-1}}\nonumber \\&\quad \times \prod _{r=1}^{j-2} \left( 1-q^{s-r}\right) . \end{aligned}$$
(38)

7 Asymptotics for lit nodes and columns

We begin with a simple estimate for the total number of lit notes. Our approach here is to consider the superdiagonal compositions that arise as superpositions of ordinary compositions of n with j columns on top of the staircase composition \(0+1+\ldots +(j-1).\) A lower bound for the height of these objects is

$$\begin{aligned}\sum _{j=1}^n \left( {\begin{array}{c}n-1\\ j-1\end{array}}\right) j=2^{n-2} (1+n).\end{aligned}$$

The average value of the lower bound is obtained by dividing this by \(2^{n-1}\) (the number of compositions of n) which gives a lower bound of \(\frac{n+1}{2}\) for the average height.

On the other hand, an upper bound for these objects is found as follows: the well-known average for the height of a composition of n is \(O(\log n)\), see Chapter 3 of [5], whilst the height of the staircase is bounded above by the height of the last column, i.e., \(j-1\). Together this yields an upper bound

$$\begin{aligned}\sum _{j=1}^n \left( {\begin{array}{c}n-1\\ j-1\end{array}}\right) (j+O(\log (n)))=2^{n-2} (1+n)+O\left( 2^n \log (n)\right) ,\end{aligned}$$

which has an average of \(\frac{n+1}{2}+O(\log (n))\).

As \(n\rightarrow \infty \) both the upper and lower bound are asymptotic to n/2.

So we have proved the following

Proposition 28

The proportion of nodes that are lit by North West light in compositions of n tends to 1/2 as \(n\rightarrow \infty \).

In fact our identity for G(q) in Corollary 23 allows us to deduce a sharper asymptotic result.

Theorem 29

As \(n \rightarrow \infty \), the average number of lit nodes is asymptotically

$$\begin{aligned} \frac{n}{2}+\frac{1}{2}+\alpha + o(1)\quad {\text {where}} \quad \alpha = \sum _{i=1}^{\infty } \frac{1}{2^{i}-1}\approx 1.66069. \end{aligned}$$
(39)

Furthermore based on Eq. (23) we get the following asymptotic estimate for the average number of lit columns:

Theorem 30

As \(n \rightarrow \infty \), the average number of lit columns is asymptotically

$$\begin{aligned} \frac{n}{4}+\frac{1}{2}+\frac{\alpha }{2}+o(1) \end{aligned}$$
(40)

where \(\alpha \) is defined as in Eq. (39).

In particular since the average number of columns of a composition of n is asymptotic to n/2, see [6], we may deduce the following

Corollary 31

The proportion of columns that are lit by North West light in compositions of n tends to 1/2 as \(n\rightarrow \infty \).

Finally we have the following conjecture for lit cells based on testing random compositions of large n:

Conjecture 32

The proportion of cells that are lit by North West light in compositions of n tends to 3/8 as \(n\rightarrow \infty \).