Ranking and Unranking Restricted Permutations
Abstract
We discuss efficient methods for unranking derangements and ménage permutations. That is, we will provide an algorithm to efficiently extract the -th earliest such permutation under the lexicographic ordering. We will show that this problem can be reduced to the problem of computing the number of restricted permutations with a given prefix, and then we will use rook theory to solve this counting problem. This has applications to combinatorics, probability, statistics, and modeling.
1 Overview and preliminaries
In 2020, Richard Arratia announced two $100 prizes with a similar flavor, both about unranking problems: given a strict total order on a finite set, when is it possible to directly compute the -th element with respect to the total order?
Problem 1 ($100 question).
For there are
elements of the set
which are called derangements.111This function is described by sequence A000166 in the On-Line Encyclopedia of Integer Sequences (OEIS) [4]. Determine the -th such permutation when listed in lexicographic order.
Answer 1.
The derangement in with rank is
The algorithm for computing this permutation will be described in Section 4.
Problem 2 ($100 question).
For there are
elements of the set
which are called ménage permutations.222 This function is described by sequence A000179 in the OEIS [4]. Determine the -th such permutation when listed in lexicographic order.
Answer 2.
The ménage permutation in with rank is
The algorithm for computing this value will be described in Section 5.
Example 3.
The derangements in , ordered lexicographically are.
In particular, unranking the th derangement in gives ; alternatively, ranking the derangement gives .
To be explicit about what we wish to compute efficiently, we define the notion of a unranking.
Definition 4.
Let be a finite set with a strict total order, and let be the unique sequence of elements in such that for all . Then a unranking is a map
that sends .
An efficient algorithm to unrank a collection of objects implies an efficient algorithm for sampling from the collection uniformly at random by sampling the indices uniformly at random. This can be of use in the case of Monte Carlo simulations and other instances where it is useful to be able to sample uniformly from a collection of combinatorial objects.
As the name suggests, every unranking problem comes with a dual problem called the “ranking problem.”
Definition 5.
A ranking of a finite set with a strict total order is a map
that sends .
The existence of both efficient ranking and unranking maps implies the existence of an efficient encoding for these objects, which may be of interest to computer scientists. The encoding works by ranking an object to get its index, which then can be stored in as a positive integer and unranked on retrieval to recover the original object.
In the remaining sections, we will show how we resolved both of the above problems in order to claim Richard Arratia’s two $100 prizes. In particular, we will construct an algorithm for ranking and unranking both derangements and ménage permutations under the lexicographic ordering. We will show that the existence of an efficient way to count the number of such permutations with a given prefix implies that there is an efficient way to compute the ranking and unranking maps. Then we will develop some ideas from rook theory and apply them to the context of derangements and ménage permutations.
2 Prefix counting and word ranking
In both the case of unranking derangements and menage permutations (and in many other applications) our combinatorial objects are words in lexicographic order, which is a generalization of alphabetical order.
We begin by developing a general theory for unranking collections of words in lexicographic order by counting the number of words with a given prefix.
2.1 Words with a given prefix
We will start by introducing some basic definitions about words and prefixes, and to formalize the notion of lexicographic order.
Definition 6.
A finite word over an alphabet is a finite sequence .
The collection of finite words over the alphabet is denoted by , or just when the alphabet is implicit from context.
Definition 7.
A word is said to begin with a prefix of length if , , and for all .
Definition 8.
A word is said to be before in lexicographic order if either is a proper prefix of , or if at the first position, , where and differ, .
With these definitions established, we can turn the problem of unranking words into a problem about counting words with specified prefixes.
Theorem 9.
For , let be a set of nonempty words on the alphabet , and let be a finite subset of words on this alphabet, with a total order given by its lexicographic order.
Let be the function that counts the number of words in that begin with a given prefix.
Then the unranking function can be computed recursively by
(1) |
where
(2) | |||||
and | (3) | ||||
, , and | (4) | ||||
and , | (5) |
where
and denotes the number of words in that occur strictly before .
Proof.
We make three claims that we will prove using induction on the recursive applications of : (1) that is the number of words in that occur strictly before , (2) that , and (3) that the sequence of s is strictly increasing.
This final claim (the sequence of s is strictly increasing) follows from the observation that in lexicographic order.
Because each iteration increases either or (the number of letters in ) or both, the number of recursive applications of required to determine is at most , which is finite because only contains of finite words.
The base case is clear: We start with because is the lexicographically earliest word, so nonempty words strictly precede it, and .
We will repeatedly use the observation that if words precede , then a word has prefix if and only if its index is in . Note that this range is empty whenever there are no words prefixed by .
Case (2). Because is the index of the last word that begins with , if , then must begin with a length- prefix that is lexicographically later than .
By construction, is the lexicographically earliest word of length that comes after , therefore . As such, the number of words that strictly precede is , which is the sum of the number of words that occur strictly before and the number of words that have prefix .
Case (3). If and , then is a proper prefix of , and is of length at least . By construction, is the lexicographically earliest word of length that has a prefix of , so , and the number of words in that precede is equal to , the number of words that precede .
Case (4). If , , and then must be the word at index , because itself is the lexicographically earliest word with the prefix . Because words cannot appear multiple times in , must have as a proper prefix. Therefore and the number of words that strictly precede is : the number of words that strictly precede plus itself.
Case (5). If and , then because itself is the lexicographically earliest word with the prefix , so it must occur at index . ∎
Notice that each recursive call of increases the sum of the letters of . If we suppose that is a finite set of words on the alphabet of length at most , then unranking a word from requires at most recursive applications of .
Therefore if there exists a polynomial time algorithm for computing , then there exists an unranking algorithm that is polynomial in the size of the alphabet and the length of the longest word. In the case of restricted permutations, each of these grow linearly with the number of letters in the ménage permutations.
2.2 Ranking words
Just as we can recursively find a word at a given index, we can also recursively find a index corresponding to a given word.
Theorem 10.
If is a collection of nonempty words over the alphabet , then the rank of the word can be computed as the sum
where
and is the indicator function of , where if and only if .
Proof.
Note that the inner sum
is the number of words in that are lexicographically later than and are less than or equal to .
By summing over the number of letters of , we count all of the words that are less than or equal to , which is precisely the rank of . ∎
3 Techniques of rook theory
Now that we have shown that we can unrank words whenever we can compute the number of words with a given prefix, we want to develop techniques for this counting problem. In the case of unranking derangements and permutations, it is useful to use ideas from rook theory, which provides a theory for understanding position-restricted permutations. Rook theory was introduced by Kaplansky and Riordan [1] in their 1946 paper The Problem of the Rooks and its Applications. In it, they discuss problems of restricted permutations in the language of rooks placed on a chessboard.
3.1 Definitions in rook theory
We begin by introducing some preliminary ideas from rook theory.
Definition 11.
A board is a subset of which represents the squares of an chessboard that rooks are allowed to be placed on. Every board has a complementary board , which consists of all of the squares of that a rook cannot be placed on.
To each board, we can associate a generating polynomial that keeps track of the number of ways to place a given number of rooks on the squares of in such a way that no two rooks are in the same row or column.
Definition 12.
The rook polynomial associated with a board ,
(6) |
is a generating polynomial where denotes the number of -element subsets of such that no two elements share an -coordinate or a -coordinate.
In the context of permutations, we’re typically interested in , the number of ways to place rooks on a restricted board. However, it turns out that a naive application of the techniques from rook theory does not immediately allow us to count the number of restricted permutations with a given prefix. Computing the number of such permutations is known to be #P-hard for a board with arbitrary restrictions. We can see this by encoding a board as a -matrix and computing the matrix permanent, since there is a bijection between boards and -matrices. (In fact, Shevelev [6] claims that “the theory of enumerating the permutations with restricted positions stimulated the development of the theory of the permanent.”)
Lemma 13.
Let be an matrix where
(7) |
Then the coefficient of in is given by the matrix permanent
(8) |
Now is an appropriate time to recall Valiant’s Theorem.
Theorem 14 (Valiant’s Theorem [9]).
The counting problem of computing the permanent of a (0,1)-matrix is #P-complete.
Corollary 15.
Computing the number of rook placements on an arbitrary board is #P-hard.
Therefore, in order to compute the number of permutations, we must exploit some additional structure of the restrictions.
3.2 Techniques of rook theory
Rook polynomials can be computed recursively. The base case is that for an empty board , the corresponding rook polynomial is , because there is one way to place no rooks, and no way to place one or more rooks.
Lemma 16 ([5]).
Given a board and a square , we can define two resulting boards from including or excluding the given square:
(9) | ||||
(10) |
Then we can write the rook polynomial for in terms of this decomposition.
(11) |
If we want to compute a rook polynomial using this construction, we can end up adding up lots of smaller rook polynomials—a number that is exponential in the size of . When the number of squares that are missing from is small, it can be easier to compute the rook polynomial of the complementary board, , and use the principle of inclusion/exclusion on its coefficients to determine the rook polynomial for the original board, .
In the case of derangements and ménage permutations, this is the strategy we’ll use. We will start by finding the resulting board from a given prefix, find the rook polynomial of the complementary board, and use the principle of inclusion/exclusion to determine the number of ways to place rooks in the resulting board.
4 Unranking derangements
4.1 Overview for unranking derangements
Richard Arratia’s question focused on unranking derangements written as words in lexicographic order. Other authors have looked at unranking derangements based on other total orderings. In particular, Mikawa and Tanaka [3] give an algorithm to rank/unrank derangements with respect to lexicographic ordering in cycle notation.
In this section we will develop an algorithm for ranking and unranking derangements with respect to their lexicographic ordering as words. The technique that we use will broadly be re-used in the next section. It is worthwhile to begin by recalling the definition of a derangement.
Definition 17.
A derangement is a permutation such that has no fixed points. That is, the set of derangements on letters is
(12) |
4.2 The complementary board
In order to compute the number of derangements with a given prefix, it is useful to look at the board that results after placing rooks according to these positions, as illustrated in Figure 2.
Definition 18.
If is an board, and is a valid prefix of length , the derived board of from , denoted , is constructed by removing rows and columns from , reindexing in such a way that both the row and column indexes are in .
The derived complementary board is the complement of with respect to .
Given a prefix of length , the number of ways of placing rooks on the derived board is, by construction, equal to the number of words in with prefix
Lemma 19.
Given a valid -letter prefix of a word on letters, the number of squares in the derived complementary board is
(13) |
and no two of these squares are in the same row or column.
Proof.
Notice that the derived complementary board can be constructed in a different order: by first taking the complement, then deleting rows and columns, and finally reindexing the squares. Because the complementary board has no two squares in the same row or column, deleting and reindexing results in a derived complementary board with the same property.
Thus, we only need to classify which squares in the complementary board are deleted to make the derived complementary board. We start by deleting squares corresponding to the deletion of the first rows, namely .
Some of these squares may also be in columns , but to avoid double-counting, we only consider those letters that are greater than . These are , as desired. ∎
4.3 Derangements with a given prefix
Now that we have a way of quickly computing , we can compute the number of ways to place a given number of rooks on the complementary board. We can use this to compute the rook polynomial for the derived complementary board . We will see later that we can use the coefficients of this polynomial to compute the number of ways of placing rooks on the derived board .
Lemma 20.
The rook polynomial for the complementary board is
(14) |
Proof.
Recall that no two squares of are in the same row or column. Thus the number of ways to place rooks is equivalent to selecting any squares from the collection of squares.
Therefore the coefficient of in the rook polynomial is . ∎
Now we introduce a lemma of Stanley [8] to compute the number of ways of placing rooks in the derived board .
Lemma 21 ([8]).
Let be a board with complementary board , and denote the rook polynomial of by .
Then the number of ways, , of placing nonattacking rooks on is given by the principle of inclusion/exclusion
(15) |
This lemma allows us to compute the number of rook placements on the derived board , which is the number of derangements in that begin with the prefix .
Corollary 22.
The number of derangements with prefix is given by
(16) |
which is in the On-Line Encyclopedia of Integer Sequences [4].
Because we can compute from in linear time (see Lemma 19), if we use a computational model where factorials are given by an oracle and arithmetic can be computed in constant time, then can be computed in linear time with respect to , the length of the prefix.
Example 23.
For , we wish to count the number of derangements that start with the prefix , as illustrated in Figure 2. Since the prefix has two letters, and . The number of squares in is
(17) |
Thus there are derangements in that start with the prefix .
Now that we have an efficient algorithm for computing , we can invoke the recursive formula in Theorem 9 to compute and unrank derangements. The sequence of recursive steps is illustrated in Table 1.
(prefix) | index range | |||
5 Unranking ménage permutations
With the bounding on unranking derangements claimed, Richard proposed a bounty for another family of restricted permutations, namely ménage permutations.
A ménage permutation comes from the problème des ménages, introduced by Édouard Lucas in 1891. There are a few choices of how to define these permutations, but we will use the following definition for simplicity.
Definition 24.
A ménage permutation is a permutation such that for all , and . The set of ménage permutations of length is denoted by .
5.1 Overview for unranking ménage permutations
As in the section about unranking derangements, we will use the fact from Theorem 9 that if we can efficiently count the number of words with a given prefix, then we can efficiently unrank the words.
The technique exploits the following observations: after placing rooks on a board corresponding to our prefix, the remaining board has the property that its complement can be partitioned into sub-boards that do not share rows or columns. These sub-boards have a structure that we can understand, and we can leverage that understanding to compute the rook polynomials of these sub-boards and consequently of the complementary board itself. Once we have computed the rook polynomial of the complementary board, we can again use Lemma 15 to compute the number of full rook placements on the original board. This gives us the number of ménage permutations with a given prefix.
5.2 Disjoint board decomposition
Figure 3 suggestively shows a placement of rooks according to a prefix that results in a board whose complement can be partitioned into sub-boards whose squares don’t share any rows or columns. We will see that this property indeed holds in general, and we can exploit this in order to count the ménage permutations with a given prefix.
The property of complements that can be partitioned into sub-boards whose squares don’t share rows or columns is useful because it provides a way of factoring the rook polynomial of the bigger board into the rook polynomials of the sub-boards.
Definition 25.
Two sub-boards and are called disjoint if no squares of are in the same row or column as any square in .
Kaplansky gives a way of computing the rook polynomial of a board in terms of its disjoint boards.
Theorem 26 ([1]).
If can be partitioned into disjoint boards , then the rook polynomial of is the product of the rook polynomials of each sub-board
(18) |
We will use this disjoint board decomposition repeatedly, because the boards that result after placing a prefix can be partitioned into disjoint sub-boards whose structure is well understood. Now we will give a name to these blocks, which are illustrated in Figure 4.
Definition 27.
A board is called staircase-shaped if it matches one of the following four shapes:
The subscripts represent the number of squares, and the names represent their parity.
We now show that our resulting boards can be partitioned into boards of these shapes.
Lemma 28.
For , and prefix the derived complementary board can be partitioned into disjoint staircase-shaped boards.
Proof.
The proof proceeds by induction on the length of the prefix.
To establish the base case, consider a prefix of length . Because of the ménage restriction, , and the derived complementary board can be partitioned into two disjoint sub-boards with shapes and . (This is illustrated for the case of and in Figure 5.)
The inductive hypothesis is that the derived complementary board for
a prefix of length consists of sub-boards with shape
,
,
, or
.
Placing a rook in row can remove a top row or a column or both in a
given sub-board.
Table 2 below
shows the resulting sub-boards after placing a rook in
-th row of ,
which may be in the top row, the -th column, or both.
Rook placement
Row
Column
,
,
Row , column
,
,
Rook placement
Row
Column
,
,
Row , column
,
,
Therefore placing any number of rooks in the first rows results in a board whose complementary derived board is composed of disjoint staircase-shaped sub-boards. ∎
5.3 Rook polynomials of blocks
Recall that the goal of partitioning into disjoint sub-boards is so that we can factor in terms of . Of course, this is only useful if we can describe , which is the goal of this subsection. Conveniently, the rook polynomial of each will turn out to depend only on the number of squares, , which can be computed recursively because of its staircase shape.
We will begin by defining a family of polynomials that, suggestively, will turn out to be the rook polynomials that we are looking for. (The coefficients of these polynomials are described by OEIS sequence A011973 [4].)
Definition 29.
For , the -th Fibonacci polynomial is defined recursively as:
(19) | ||||
(20) | ||||
(21) |
The rook polynomials of the staircase-shaped boards agree with these Fibonacci polynomials.
Lemma 30.
If is a staircase-shaped board with squares, then has rook polynomial , equal to the -th Fibonacci polynomial.
Proof.
We will recall the recursive construction of rook polynomials from Lemma 11, and proceed by induction on the number of squares, always choosing to include or exclude the upper-left square.
Since the reflections of board have the same rook polynomial as the unreflected board, without loss of generality, we will compute the rook polynomials for and , respectively.
To establish a base case, consider the rook polynomials when , so the even board has squares and the odd board has square. We can see the corresponding rook polynomials directly. There is way to place rooks on and no ways to place more rooks; similarly there is way to place rooks on , way to place rook on , and no way to place more than one rook. Thus
(22) | |||||
(23) |
With the base case established, our inductive hypothesis is that whenever is a staircase-shaped board with squares.
Assume that we have squares where is even, so our board looks like . We can either place a rook or not in the upper-left square. If we include the square, then , if we exclude the square, then . Thus by Lemma 11, the rook polynomial of is
(24) | ||||
(25) | ||||
(26) |
The case where is odd proceeds in almost the same way. Here our board looks like . We can either place a rook or not in the upper-left square. If we include the square, then , if we exclude the square, then . Again by Lemma 11, the rook polynomial of is
(27) | ||||
(28) | ||||
(29) |
∎
Therefore, we now have the ingredients to describe the rook polynomial of a derived complementary board.
Corollary 31.
Suppose that can be partitioned into disjoint staircase-shaped sub-boards of sizes . Then the rook polynomial of is
(30) |
where is the -th Fibonacci polynomial.
5.4 Sub-boards from prefix
In this part, we discuss how to algorithmically compute the size of the sub-boards of the partition of the derived complementary board for a given prefix .
Lemma 32.
Given a nonempty prefix and , the number of squares of in column that do not have a first coordinate in is given by the rule:
(31) |
Proof.
It is helpful to recall that the complementary board consists of squares on the diagonal, squares on the subdiagonal, and the square :
(32) |
Now if , then and both have a first coordinate less than or equal to .
If , then has a first coordinate in , but does not have its first coordinate in .
If , there are two squares of in column : and . Only has its first coordinate in .
If , then neither the square nor has its first coordinate in . ∎
Now we will go through each contiguous section of columns, and count the number of squares in each to build up the size of each of the blocks.
Lemma 33.
Partition into contiguous parts, . Each part of the partition corresponds to a staircase-shaped sub-board of size .
Therefore the size of the disjoint sub-boards in the derived complementary board is given by the multiset
(33) |
Proof.
Once the first row of a complementary ménage board has been deleted, the resulting board has the property that any two nonadjacent columns do not have any squares in the same row, because column has squares in and .
Within each contiguous interval between the letters of , the columns form a staircase-shaped sub-board because each column with a square in position has a square to its right, in position whenever . ∎
Example 34.
As illustrated in Figure 3, if and , then the contiguous partition of
(34) |
is . The corresponding staircase-shaped sub-boards have sizes
which matches what we observe in the illustration:
(35) |
5.5 Complementary polynomials
We have now established a method taking a prefix and partitioning into disjoint staircase-shaped sub-boards, which allow us to determine the rook polynomial of . Using Lemma 15, this allows us to finally compute the number of ways of placing rooks on , thus determining the number of derangements that begin with .
Theorem 35.
The number of ménage permutations that begin with a valid, nonempty prefix is
(36) |
where , is the -th Fibonacci polynomial, and is the multiset corresponding to the size of the staircase-shaped sub-boards in the disjoint partition of .
Now that we have computed the number of ménage permutations, Theorem 9 provides an efficient unranking algorithm for .
We will illustrate this with a specific example computing the number of ménage permutations with a given prefix.
Example 36.
We’ve already seen that the for , the prefix partitions the derived complementary board into three nonempty sub-boards:
(37) |
Lemma 30 tells us that the rook polynomial of is
(38) | ||||
(39) | ||||
(40) | ||||
(41) |
By Lemma 15, the number of ways to place eight rooks on is is
(42) | ||||
(43) | ||||
(44) |
Therefore there are ménage permutations in that start with the prefix .
We can now repeatedly use the above counting technique in conjunction with Theorem 9 to unrank derangements.
Example 37.
There are ménage permutations on letters. Table 3 shows the steps of the algorithm that determines that the th ménage permutation in lexicographic order is
(45) |
index range | block sizes | |||
6 Generalizations and open questions
In this final section we explore several possible future directions for applying these ideas in new contexts. We can potentially apply these unranking techniques to position-restricted permutations, permutations that satisfy certain inequalities with respect to a permutation statistic, or words that avoid or match certain patterns.
6.1 Other restricted permutations
In a 2014 paper about finding linear recurrences for derangements, ménage permutations and other restricted permutations, Doron Zeilberger introduces a more general family of restricted permutations.
Definition 38 ([10]).
Let be a finite collection of integers. An -avoiding permutation is a permutation such that
(46) |
Example 39.
In terms of -avoiding permutations,
-
•
ordinary permutations are -avoiding permutations,
-
•
derangements are -avoiding permutations, and
-
•
ménage permutations are -avoiding permutations.
The results in the previous sections straightforwardly adapt to the cases of unranking -avoiding and avoiding permutations.
Open Question 40.
For arbitrary finite subsets , do there exist efficient unranking algorithms on -avoiding permutations?
The techniques used to unrank derangements and ménage permutations do not appear to generalize even to superficially similar domains. So, in the spirit of Richard Arratia’s bounties, it is only fair to offer one of my own.
Problem 41 ($100 question).
Do there exist efficient unranking algorithms on -avoiding permutations?
The main obstruction to using the techniques from Section 5 to resolve this question is that placing a rook and deleting a column does not necessarily cause the left and right sides of that column to be disjoint. As such, unranking -avoiding permutations appears to require a genuinely novel insight.
6.2 Permutation statistics
Another area for exploration is unranking permutations with a given permutation statistic.
Open Question 42.
Let be the map that counts inversions of a permutation. Since is a Mahonian statistic, the generating function for the number of permutations such that is given by the analog of , .
Does there exist an efficient unranking function on the set
(47) |
and if so, how does one construct it?
We can, of course, substitute with any other permutation statistic of interest.
6.3 Pattern avoidance
In the field of combinatorics on words, there exists a notion of patterns and instances of a pattern. At this level of informality, this is probably best illustrated with an example (with undefined words in bold).
Example 43.
The word is an instance of the pattern with and . The word is said to match the pattern with because it contains a substring of the form .
Open Question 44.
Given a pattern , is it possible to unrank words of length over an alphabet that are not instances of the pattern ? That match the pattern ? That don’t match the pattern ?
6.4 Prefixes of Lyndon words
There are other collections of finite words that might be amenable to some of the above techniques. In particular, Kociumaka, Radoszewski, and Rytter [2] give polynomial time algorithms for unranking Lyndon words. We have some conjectures about prefixes of Lyndon words and open questions about other restricted words.
Definition 45.
A Lyndon word is a string over an alphabet of letters that is the unique minimum with respect to all of its rotations.
Example 46.
is a Lyndon word because
(48) |
is the unique minimum of all of its rotations.
is not a Lyndon word because while
(49) |
it is not the unique minimum. (That is, rotating it three positions returns it to itself.)
Definition 47 ([7]).
Suppose that and are integer sequences related by
(50) |
Then is said to be the Euler transform of , denoted .
Definition 48.
Let where is the number of Lyndon words with prefix and length over the alphabet .
Conjecture 49.
The Euler transform of the number of Lyndon words with prefix and length over the alphabet , , follows a linear recurrence for all .
This conjecture and the following conjectures are based on the data in Table 4.
and | Conjectured recurrence | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | 1 | 2 | 3 | 6 | 9 | 18 | 30 | 56 | 99 | 186 | 335 | |||
1 | 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128 | 256 | 512 | 1024 | |||
0 | 0 | 1 | 2 | 4 | 7 | 14 | 25 | 48 | 88 | 168 | 310 | |||
1 | 0 | 0 | 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128 | 256 | |||
0 | 1 | 1 | 1 | 2 | 2 | 4 | 5 | 8 | 11 | 18 | 25 | |||
1 | 0 | 1 | 1 | 2 | 3 | 5 | 8 | 13 | 21 | 34 | 55 | |||
0 | 0 | 0 | 1 | 2 | 4 | 8 | 15 | 30 | 57 | 112 | 214 | |||
1 | 0 | 0 | 0 | 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128 | |||
0 | 0 | 1 | 1 | 2 | 3 | 6 | 10 | 18 | 31 | 56 | 96 | |||
1 | 0 | 0 | 1 | 1 | 2 | 4 | 7 | 13 | 24 | 44 | 81 | |||
0 | 0 | 0 | 0 | 1 | 1 | 2 | 3 | 5 | 7 | 12 | 18 | |||
1 | 0 | 0 | 0 | 0 | 1 | 1 | 2 | 3 | 5 | 8 | 13 | |||
0 | 0 | 1 | 1 | 1 | 1 | 2 | 2 | 3 | 4 | 6 | 7 | |||
1 | 0 | 0 | 1 | 1 | 1 | 2 | 3 | 4 | 6 | 9 | 13 | |||
0 | 0 | 0 | 0 | 1 | 2 | 4 | 8 | 16 | 31 | 62 | 121 | |||
1 | 0 | 0 | 0 | 0 | 1 | 2 | 4 | 8 | 16 | 32 | 64 | |||
0 | 0 | 0 | 1 | 1 | 2 | 4 | 7 | 14 | 26 | 50 | 93 | |||
1 | 0 | 0 | 0 | 1 | 1 | 2 | 4 | 8 | 15 | 29 | 56 | |||
0 | 0 | 0 | 0 | 1 | 1 | 3 | 5 | 9 | 16 | 30 | 53 | |||
1 | 0 | 0 | 0 | 0 | 1 | 1 | 3 | 5 | 9 | 17 | 31 | |||
0 | 0 | 0 | 1 | 1 | 2 | 3 | 5 | 9 | 15 | 26 | 43 | |||
1 | 0 | 0 | 0 | 1 | 1 | 2 | 3 | 6 | 10 | 18 | 31 | |||
0 | 0 | 0 | 0 | 1 | 1 | 2 | 3 | 5 | 7 | 12 | 18 | |||
1 | 0 | 0 | 0 | 0 | 1 | 1 | 2 | 3 | 5 | 8 | 13 | |||
0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 2 | 3 | 4 | |||
1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 2 | 3 | |||
0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 2 | 2 | 3 | 3 | |||
1 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 2 | 3 | 4 | 5 |
We start with two specific conjectures about two families of prefixes.
Conjecture 50.
For , let be the sequence of the number of Lyndon words of length with prefix of length over the alphabet . Then the Euler transform follows the linear recurrence for all .
Conjecture 51.
For let be the sequence of the number of Lyndon words of length with prefix of length over the alphabet . Then the Euler transform follows the linear recurrence for all .
And more broadly, we have a conjecture in the case that the prefix is not the zero sequence.
Conjecture 52.
Let be the sequence of the number of Lyndon words of length with prefix over the alphabet such that contains at least one . Then the Euler transform of the sequence, , follows the linear recurrence where all terms have coefficients of or .
Open Question 53.
If, as the evidence suggests, follows a linear recurrence, what is the length of the recurrence and what are the coefficients of the recurrence as a function of ?
References
- [1] Irving Kaplansky and John Riordan “The problem of the rooks and its applications” In Duke Mathematical Journal 13.2 Duke University Press, 1946, pp. 259–268 DOI: 10.1215/S0012-7094-46-01324-5
- [2] Tomasz Kociumaka, Jakub Radoszewski and Wojciech Rytter “Computing k-th Lyndon Word and Decoding Lexicographically Minimal de Bruijn Sequence” In Combinatorial Pattern Matching Springer International Publishing, 2014, pp. 202–211
- [3] Kenji Mikawa and Ken Tanaka “Lexicographic ranking and unranking of derangements in cycle notation” In Discret. Appl. Math. 166, 2014, pp. 164–169
- [4] OEIS Foundation Inc. “The On-Line Encyclopedia of Integer Sequences”, 2021 URL: https://oeis.org/
- [5] John Riordan “An Introduction to Combinatorial Analysis” USA: Princeton University Press, 1980
- [6] V.. Shevelev “Some problems of the theory of enumerating the permutations with restricted positions” In Journal of Soviet Mathematics 61.4, 1992, pp. 2272–2317 DOI: 10.1007/BF01104103
- [7] Neil James Alexander Sloane and Simon Plouffe “Encyclopedia of Integer Sequences” San Diego: Academic Press, 1995
- [8] Richard P. Stanley “Enumerative Combinatorics: Volume 1” USA: Cambridge University Press, 2011
- [9] L.G. Valiant “The complexity of computing the permanent” In Theoretical Computer Science 8.2, 1979, pp. 189–201 DOI: https://doi.org/10.1016/0304-3975(79)90044-6
- [10] Doron Zeilberger “Automatic Enumeration of Generalized Ménage Numbers” In Séminaire Lotharingien de Combinatoire 71.B71a, 2014