Abstract
Integer compositions of n are viewed as bargraphs with n circular nodes or square cells in which the ith part of the composition \(x_i\) is given by the ith column of the bargraph with \(x_i\) nodes or cells. The sun is at infinity in the north west of our two dimensional model and each node/cell may or may not be lit depending on whether it stands in the shadow cast by another node/cell to its left. We study the number of lit nodes in an integer composition of n and later we modify this to yield the number of lit square cells. We then count the number of columns being lit which leads naturally to those cases where only the first column is lit. We prove the theorem that the generating function for the latter is the same as the generating function for compositions in which the first part is strictly smallest. This theorem has interesting q-series identities as corollaries which allow us to deduce in a simple way the asymptotics for both the number of lit nodes and columns as \(n \rightarrow \infty \).
Similar content being viewed by others
Avoid common mistakes on your manuscript.
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.
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.
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.
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
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
\(\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
Proof
By definition of \(F_k\) and using Eq. (1),
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
The series expansion for G(q) begins
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.
The series for this begins
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
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.
Prepending a 1 to any composition of n.
-
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):
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
Multiplying by \(q^{n+1}\) and summing over n, we obtain
and hence
\(\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 i, j 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 x, q 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
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 i, j as
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 i, j, s, p and m to vary through the full range of possible values as shown in the sums below:
This simplifies to
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
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
The series expansion \(G_2(q)\) begins
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
The last m parts have generating function
Next we combine these and sum for i, s over the limits shown below. After simplification, we obtain
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
The series expansion for this begins
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
The series for this begins
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
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
with series expansion beginning
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
with series expansion beginning
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
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:
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
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
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.
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
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
because as shown in paper [7] and in Lemma 13, the generating function for compositions with weakly smallest part first is
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
We need the following Lemma:
Lemma 20
For fixed integers \(m\ge 0\)
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:
By using the q-binomial recursion (10.0.3) found in [1], Eq. (26) is equivalent to Eq. (27) below.
By multiplying Eq. (27) by \(q^m/(1 - q^m)\) we obtain
The right hand side of (28) is equivalent to that of the statement since
\(\square \)
Next, we do the proof of Proposition 19.
Proof
Rewrite the right hand side of Eq. (25) as
Now, we rewrite the left hand side of Eq. (25) as
By deleting the common factors from the right hand sides of Eqs. (29) and (30) it remains necessary to show that
In fact we will show that for each positive integer m,
We transform Eq. (32) into a q-binomial identity
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
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
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
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
Remark 25
From Eqs. (36) and (37), we infer the identity
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
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
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
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
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
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 \).
Data availibility
Not applicable.
References
Andrews, G.E., Askey, R., Roy, R.: Special Functions. Cambridge University Press, Cambridge (1999)
Archibald, M., Blecher, A., Brennan, C., Knopfmacher, A., Mansour, T.: Shedding light on words. App. Anal. Discrete Math. 11, 216–231 (2017)
Archibald, M., Blecher, A., Knopfmacher, A., Mays, M.: Inversions and parity in compositions of integers. J. Int. Seq. 23, 2041 (2020)
Deutsch, E., Munarini, E., Rinaldi, S.: Skew Dyck paths, area, and superdiagonal bargraphs. J. Stat. Plann. Infer. 140(6), 1550–1562 (2010)
Flajolet, P., Sedgewick, R.: Analytic Combinatorics. Cambridge University Press, Cambridge (2009)
Heubach, S., Mansour, T.: Combinatorics of Compositions and Words. CRC Press, London (2010)
Knopfmacher, A., Robbins, N.: Compositions with parts constrained by the leading summand. Ars Combin. 76, 287–295 (2005)
Prodinger, H.: Visibility problems related to skip lists. Australas. J. Comb. 72(3), 509–515 (2018)
Van Rensburg, E.J.: Adsorbing bargraph paths in a \(q\)-wedge. J. Phys. A Math. Gen 38, 8505–8525 (2005)
The OEIS Foundation, The On-line Encyclopedia of Integer Sequences (https://oeis.org/)
Acknowledgements
Not applicable.
Funding
Open access funding provided by University of the Witwatersrand.
Author information
Authors and Affiliations
Contributions
Michael Mays suggested the problem and programmed the ideas of the problem in Mathematica. He also prepared all the figures in the paper. Using the program devised by Michael Mays, Aubrey Blecher and Arnold Knopfmacher conjectured and proved various results that appear in the main manuscript text. All authors reviewed and polished the manuscript.
Corresponding author
Ethics declarations
Conflict of interest
Not applicable.
Consent for publication
Not applicable.
Ethics approval and consent to participate
Not applicable.
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.
About this article
Cite this article
Blecher, A., Knopfmacher, A. & Mays, M. Casting light on integer compositions. Aequat. Math. (2024). https://doi.org/10.1007/s00010-024-01094-w
Received:
Revised:
Accepted:
Published:
DOI: https://doi.org/10.1007/s00010-024-01094-w