Fact-checked by Grok 2 weeks ago

Lehmer code

The Lehmer code, also known as the inversion table or inversion vector, is a bijective encoding of a permutation \sigma \in S_n (the symmetric group on n elements) as a vector c_\sigma = (c_1, c_2, \dots, c_n) in the set C_n = \{0\} \times [0,1] \times [0,2] \times \cdots \times [0, n-1], where c_x = |\{ y : y < x, \sigma(y) > \sigma(x) \}| for each position x = 1, \dots, n, counting the number of larger values to the left of position x in the one-line notation of \sigma. This representation uniquely maps each permutation to a sequence of non-negative integers satisfying $0 \leq c_x \leq x-1, with c_1 = 0 always, enabling efficient encoding and decoding in linear time O(n). The code provides a natural way to order permutations lexicographically via the factorial number system, where the index of a permutation corresponds directly to the integer value of its Lehmer code interpreted in base factorials. Named after the mathematician Derrick Henry "D. H." Lehmer (1905–1991), who described the code in detail in his 1960 paper "Teaching Combinatorial Tricks to a Computer" in the context of algorithmic generation of permutations, the underlying inversion table concept has roots in 19th-century but gained prominence through Lehmer's work, which emphasized its practical implementation for computer-based enumeration and analysis. In modern applications, the Lehmer code facilitates rank aggregation in , where it compresses partial rankings into vectors for efficient probabilistic modeling and optimization under metrics like . It is also employed in permutation entropy calculations for analysis, enumerative coding for data compression, and generating uniform random in algorithms, due to its prefix-free property and simplicity in decoding to the corresponding permutation via insertion of elements in decreasing order. These properties make it a foundational tool in , with extensions to weak orders, parabolic quotients, and even non-classical permutation structures like those in Coxeter groups.

History and Definition

Historical Background

The Lehmer code traces its origins to the late , when Charles-Ange Laisant introduced a numbering system for representing in his seminal paper. In this work, Laisant described a method to enumerate and encode using bases, providing a systematic way to assign unique indices to each permutation without employing the modern terminology of "Lehmer code." This innovation emerged within the broader context of , where Laisant and contemporaries sought efficient tools for cataloging combinatorial objects during an era of growing interest in permutation theory. The encoding was first proposed around 1906 by American mathematician and later elaborated in detail by his son, . The concept gained prominence in the mid-20th century through the efforts of , who adapted and popularized the encoding scheme for computational purposes. In his 1960 paper, Lehmer presented the code as a practical tool for generating and manipulating on early computers, emphasizing its utility in combinatorial enumeration algorithms. This development reflected the era's shift toward computer-assisted mathematics, where Lehmer's expertise in and permutation generation addressed the need for efficient data structures in automated problem-solving. Although the Lehmer code is named after Derrick Henry Lehmer, its foundational ideas bear resemblance to earlier notions like inversion tables, which served as precursors in permutation analysis. The code's evolution from Laisant's theoretical framework to the Lehmers' computational applications underscores its enduring role in bridging classical combinatorics with modern computing.

Formal Definition

The Lehmer code of a permutation \sigma of the set = \{1, 2, \dots, n\} is the sequence L(\sigma) = (L(\sigma)_1, L(\sigma)_2, \dots, L(\sigma)_n), where each entry is defined as L(\sigma)_i = \bigl|\{j < i : \sigma(j) > \sigma(i)\}\bigr| for i = 1, 2, \dots, n. This counts, for each position i, the number of elements to the left of i in the permutation that are larger than \sigma(i), providing a measure of the left-inversions involving the element at position i. For example, consider the permutation \sigma = (3, 1, 4, 2) of {{grok:render&&&type=render_inline_citation&&&citation_id=4&&&citation_type=wikipedia}}.
  • For i=1, \sigma(1)=3; no elements to the left, so L(\sigma)_1 = 0.
  • For i=2, \sigma(2)=1; the element to the left is $3 > 1 (one element), so L(\sigma)_2 = 1.
  • For i=3, \sigma(3)=4; the elements to the left are $3 < 4 and $1 < 4 (zero elements larger), so L(\sigma)_3 = 0.
  • For i=4, \sigma(4)=2; the elements to the left are $3 > 2, $1 < 2, $4 > 2 (two elements), so L(\sigma)_4 = 2.
    Thus, L(\sigma) = (0, 1, 0, 2).
Each L(\sigma)_i is an integer satisfying $0 \leq L(\sigma)_i \leq i-1, and the mapping from permutations to their Lehmer codes is bijective, uniquely identifying each permutation of $$.

Encoding and Decoding

Encoding a Permutation

To encode a permutation \sigma of n elements into its Lehmer code L(\sigma) = (L_1, L_2, \dots, L_n), where each L_i satisfies $0 \leq L_i \leq n - i, proceed sequentially from left to right, tracking the set of unused elements at each step. This process counts, for each position i, the number of unused elements smaller than \sigma(i) that have not yet appeared in the prefix \sigma(1) to \sigma(i-1). Equivalently, L_i is the number of elements to the right of position i that are smaller than \sigma(i), as the unused elements at step i consist precisely of \sigma(i) and the elements in positions i+1 to n. The algorithm is as follows:
  1. Initialize the set of available elements as S = \{1, 2, \dots, n\} (assuming the is of the numbers 1 through n).
  2. For each position i from 1 to n:
  3. The resulting sequence (L_1, L_2, \dots, L_n) is the Lehmer code.
This approach has a of O(n^2) in a naive implementation but can be optimized to O(n \log n) using data structures like fenwick trees or balanced search trees to query the count of smaller elements efficiently. The encoding directly constructs the right-inversion table of the , where each L_i records the inversion count with respect to later positions, building the table from left to right while implicitly accounting for rightward dependencies. Consider the example permutation of seven elements represented by letters A=1, B=2, C=3, D=4, E=5, F=6, G=7: \sigma = (B, F, A, G, D, E, C), or numerically [2, 6, 1, 7, 4, 5, 3].
  • Start with S = \{1,2,3,4,5,6,7\}. For i=1, \sigma(1)=2; smaller elements in S: 1 (count=1). Set L_1=1, remove 2; S=\{1,3,4,5,6,7\}.
  • For i=2, \sigma(2)=6; smaller in S: 1,3,4,5 (count=4). Set L_2=4, remove 6; S=\{1,3,4,5,7\}.
  • For i=3, \sigma(3)=1; smaller in S: none (count=0). Set L_3=0, remove 1; S=\{3,4,5,7\}.
  • For i=4, \sigma(4)=7; smaller in S: 3,4,5 (count=3). Set L_4=3, remove 7; S=\{3,4,5\}.
  • For i=5, \sigma(5)=4; smaller in S: 3 (count=1). Set L_5=1, remove 4; S=\{3,5\}.
  • For i=6, \sigma(6)=5; smaller in S: 3 (count=1). Set L_6=1, remove 5; S=\{3\}.
  • For i=7, \sigma(7)=3; smaller in S: none (count=0). Set L_7=0, remove 3; S=\emptyset.
The Lehmer code is L = [1, 4, 0, 3, 1, 1, 0].

Decoding a Lehmer Code

The Lehmer code establishes a between the set of all of n elements and the set of integer sequences L = (L_1, L_2, \dots, L_n) satisfying $0 \leq L_i \leq n - i for each i = 1, \dots, n. Decoding reconstructs the unique permutation \sigma corresponding to L via an algorithm that operates in linear time O(n). The algorithm begins with the set of available elements S = \{1, 2, \dots, n\}, sorted in increasing order. For each i from 1 to n, it selects the (L_i + 1)-th smallest from the current S as \sigma(i) and removes that from S. This process builds \sigma from left to right, ensuring each choice respects the inversion counts encoded in L. In detail, for each i, L_i specifies the number of smaller unused to skip before selecting the next one; the selected is thus the one that would have exactly L_i remaining smaller placed after it in the . This step-wise selection guarantees the , as every valid L produces a unique \sigma and vice versa. The decoding is the inverse of the encoding , which counts right inversions for each . Consider the example with n=7 and L = [1, 4, 0, 3, 1, 1, 0]. Start with S = \{1, 2, 3, 4, 5, 6, 7\}.
  • For i=1, L_1=1: Select the 2nd smallest in S (which is 2); set \sigma(1) = 2, update S = \{1, 3, 4, 5, 6, 7\}.
  • For i=2, L_2=4: Select the 5th smallest in S (1, 3, 4, 5, 6 → 6); set \sigma(2) = 6, update S = \{1, 3, 4, 5, 7\}.
  • For i=3, L_3=0: Select the 1st smallest in S (1); set \sigma(3) = 1, update S = \{3, 4, 5, 7\}.
  • For i=4, L_4=3: Select the 4th smallest in S (3, 4, 5, 7 → 7); set \sigma(4) = 7, update S = \{3, 4, 5\}.
  • For i=5, L_5=1: Select the 2nd smallest in S (3, 4 → 4); set \sigma(5) = 4, update S = \{3, 5\}.
  • For i=6, L_6=1: Select the 2nd smallest in S (3, 5 → 5); set \sigma(6) = 5, update S = \{3\}.
  • For i=7, L_7=0: Select the 1st smallest in S (3); set \sigma(7) = 3, update S = \emptyset.
The resulting permutation is \sigma = (2, 6, 1, 7, 4, 5, 3). To verify, apply the encoding algorithm to \sigma: Count, for each position i, the number of j > i such that \sigma(j) < \sigma(i). This yields exactly the original L = [1, 4, 0, 3, 1, 1, 0], confirming the reconstruction.

Properties

Relation to the Factorial Number System

The Lehmer code provides a direct bijection between the set of all permutations of n elements, denoted S_n, and the integers in the range [0, n! - 1] through its interpretation as a representation in the . This connection was introduced by Derrick Lehmer to facilitate computational enumeration of permutations by assigning each one a unique numerical index corresponding to its position in colexicographic order. The , also known as the factoradic system, is a mixed radix numeral system where the place values are the factorials k! for positions indexed from the right starting at k=0, and each digit l_k satisfies $0 \leq l_k \leq k. This ensures every nonnegative integer up to n! has a unique representation without leading zeros beyond the necessary positions. For a permutation \sigma \in S_n, the reversed Lehmer code (c_n, c_{n-1}, \dots, c_1) (where c_x is as defined) uses digits that exactly fit these constraints, as the values count the inversions in a way that aligns with colex ordering from right to left. The rank r(\sigma), or colexicographic index, is then computed as the value of this factoradic number: r(\sigma) = \sum_{k=1}^{n} c_k \cdot (k-1)! This formula maps each permutation uniquely to its ordinal position, starting from 0 for the identity permutation. For instance, with n=7 and Lehmer code c_\sigma = [0, 1, 1, 3, 0, 4, 1] (so reversed [1, 4, 0, 3, 1, 1, 0]), the rank is r(\sigma) = 0 \cdot 0! + 1 \cdot 1! + 1 \cdot 2! + 3 \cdot 3! + 0 \cdot 4! + 4 \cdot 5! + 1 \cdot 6! = 0 + 1 + 2 + 18 + 0 + 480 + 720 = 1221. This places \sigma as the 1222nd permutation (1-indexed) in colexicographic order among the $7! = 5040 total. This numerical bijection enables efficient sorting and traversal of permutations by treating them as integers in the , which underpins algorithms for generating permutations in colexicographic sequence without redundant computations.

Statistical Properties and Independence

When considering a uniformly random permutation \sigma of = \{1, 2, \dots, n\}, the components of its Lehmer code L(\sigma) = (L_1, L_2, \dots, L_n) exhibit notable probabilistic behavior. Specifically, each L_i is uniformly distributed over the set \{0, 1, \dots, i-1\}, and the L_i are mutually independent random variables. This uniformity arises because, for each fixed i, the value L_i counts the number of elements to the left of position i that are larger than \sigma_i; since \sigma is random, \sigma_i is equally likely to be in any rank among the prefix \sigma_1, \dots, \sigma_i, yielding P(L_i = k) = 1/i for k = 0, 1, \dots, i-1. The independence follows from the fact that the relative ordering within each prefix is uniformly random and the counts decouple across positions due to the exchangeability of the permutation. The sum \sum_{i=1}^n L_i equals the total number of inversions in \sigma, and under the uniform distribution, this sum has expected value n(n-1)/4. This expectation can be derived by linearity: each possible pair (j, k) with j < k forms an inversion with probability $1/2, and there are \binom{n}{2} such pairs. In the Lehmer code, the positions i where L_i = 0 precisely correspond to the left-to-right maxima of \sigma, as L_i = 0 means no element to the left of i is larger than \sigma_i. The number of left-to-right maxima is thus the count of such zeros in L(\sigma), while the number of right-to-left maxima can be expressed analogously using a suitable transformation of the code components. The independence of the L_i under uniform random permutations enables efficient sampling and simulation techniques, facilitating Monte Carlo methods in modern combinatorics, such as learning distributions over permutation spaces in post-2020 computational studies.

Applications

Combinatorial Enumeration

Lehmer codes play a central role in combinatorial enumeration by enabling unranking, the process of generating the specific permutation corresponding to a given rank r in the range [0, n! - 1] under lexicographic order. The rank r is expressed in the factorial number system, yielding digits d_{n-1}, d_{n-2}, \dots, d_1 where $0 \leq d_k \leq k and r = \sum_{k=1}^{n-1} d_k \cdot k!. These digits form the Lehmer code, and decoding proceeds by successively selecting the d_k-th (0-based index) unused element from the remaining set \{1, 2, \dots, n\} to build the permutation. This bijection ensures every rank maps uniquely to a permutation, facilitating direct access without generating preceding ones. In applications, Lehmer codes support efficient algorithms for enumerating all permutations without duplicates or omissions, as successive unranking from ranks 0 to n! - 1 produces the complete lexicographic list. Historically, incorporated these codes into mechanical computing devices, known as teaching machines, to solve combinatorial problems like permutation generation and counting, as detailed in his foundational work on machine tools for combinatorics. Such methods allowed early digital and analog computers to tackle enumeration tasks that were otherwise infeasible by exhaustive search. For illustration, consider n = 4 and rank r = 5 (0-based). The factorial representation is $5 = 0 \cdot 3! + 2 \cdot 2! + 1 \cdot 1! + 0 \cdot 0!, yielding Lehmer code digits (0, 2, 1, 0). Starting with the set \{1, 2, 3, 4\}:
  • Select the 0-th element: 1; remaining: \{2, 3, 4\}.
  • Select the 2-nd element: 4; remaining: \{2, 3\}.
  • Select the 1-st element: 3; remaining: \{2\}.
  • Select the 0-th element: 2.
The resulting permutation is (1, 4, 3, 2), the 6th in . Extensions of Lehmer codes to restricted permutations adapt the inversion-based encoding to enforce constraints. For derangements (permutations without fixed points), modified codes ensure the first digit is at least 1 and subsequent selections avoid the natural position, using adjusted inversion counts to enumerate the !n derangements. Similarly, for pattern-avoiding permutations, inversion tables (equivalent to Lehmer codes) are restricted to avoid specific subsequences, enabling enumeration of classes like 132-avoiders via bijective mappings that preserve the avoidance property. The basic unranking algorithm via Lehmer codes has O(n^2) time complexity due to linear scans over remaining elements at each step, though optimized versions using data structures like Fenwick trees achieve linear time. In software libraries, such as Python's itertools.permutations introduced in version 2.6 (2008), efficient generation leverages lexicographic ordering akin to unranking techniques, enabling scalable enumeration for practical combinatorial tasks. The independence of Lehmer code digits further supports uniform sampling in enumeration algorithms.

Probability and Optimal Stopping

The secretary problem, also known as the optimal stopping or marriage problem, involves selecting the best candidate from a sequence of n applicants who arrive in random order, with decisions made irrevocably after each interview based solely on relative rankings observed so far. The goal is to maximize the probability of selecting the overall best applicant. The classical optimal strategy rejects the first r-1 applicants, where r ≈ n/e ≈ 0.3679n, and then selects the first subsequent applicant who ranks higher than all previously seen ones (a "record" or best-so-far). This approach yields a success probability that approaches 1/e ≈ 0.3679 as n increases, with the limiting value derived from the uniformity of the random permutation modeling the arrival order. In this framework, the Lehmer code of the underlying random permutation encodes the relative rankings revealed during interviews, facilitating probabilistic analysis of stopping decisions. Specifically, assuming ranks with lower numbers indicating superior applicants, the k-th entry L_k in the counts the number of worse applicants (higher ranks) among the first k-1 interviewees relative to the k-th applicant. The number of superior previous applicants is thus (k-1) - L_k, and the relative rank of the current applicant among those seen is k - L_k (1 being best so far, k worst). Thus, L_k = k-1 if and only if the k-th applicant is the best so far, corresponding to a left-to-right minimum in the permutation ranks (or equivalently, a right-to-left maximum when the sequence is reversed). The partial up to step k thus captures all available information for decision-making at that point. The optimal stopping strategy leverages the statistical properties of the Lehmer code, particularly the independence of its components, where L_k is uniformly distributed on {0, 1, ..., k-1} and independent of prior entries. At step k, if L_k = k-1 (best so far), the probability that this applicant is the global best (lowest rank) is precisely k/n, as the position of the overall best is uniformly random and independent of the observed relative ranks. The decision to stop weighs this probability against the expected success probability of continuing, computed via the remaining potential records; stopping is advisable if k/n exceeds the value of waiting, leading to the 1/e threshold in the limit. In more refined analyses, the observed partial code enables estimation of whether the global best lies ahead by assessing inversion probabilities in the unseen suffix, such as the likelihood of future L_i = k-1 events signaling later records. For illustration with n=10, the optimal strategy rejects the first 3 applicants and stops at the first best-so-far thereafter (r=4), achieving a success probability of approximately 0.398. Using the , at k=4 if L_4=3, the immediate success probability is 4/10=0.4; continuing yields an expected success of about 0.398 via potential records at later steps, confirming the threshold. The expected remaining inversions after k=3, given by ∑_{i=4}^{10} (i-1)/2 ≈ 14.5, quantify the anticipated disorder in the suffix, informing that the probability of a superior record ahead aligns with the uniform positioning of the best. Ferguson (1989) provides a historical and analytical foundation for the problem, framing it as a dynamic programming solution where states track the number of remaining applicants and the status of the current record, implicitly incorporating relative rank data akin to partial for recursive probability computations. Modern extensions in online algorithms during the 2020s apply partial to model streaming arrival orders in adversarial or biased settings, such as generalized selection problems where the permutation is revealed component-wise, enabling dynamic strategies that outperform classical bounds by adapting to partial inversion information in real-time data streams.

Inversion Tables

The inversion table of a permutation σ in the symmetric group S_n is defined as the sequence I(σ) = (I_1, I_2, ..., I_n), where I_j = |\{ i < j : \sigma(i) > \sigma(j) \}| for each position j from 1 to n. This counts the number of left inversions at each position j, measuring how many elements to the left of σ(j) are greater than it. Each I_j satisfies 0 ≤ I_j ≤ j-1, and the map from permutations to inversion tables is a , providing a unique encoding of σ. The Lehmer code is synonymous with the inversion table in much of the , both representing the same bijective encoding based on left inversions by position. This equivalence arises from historical developments in enumeration, with early work by figures like Charles-Ange Laisant on inversion counts contributing to both concepts. For example, consider the permutation σ = (3, 1, 4, 2). Its inversion table (also Lehmer code) is I = (0, 1, 0, 2), reflecting zero left inversions at position 1, one at position 2 (from 3 > 1), zero at position 3, and two at position 4 (from 3 > 2 and 4 > 2). In software implementations, tools like Wolfram Alpha compute inversion tables (Lehmer codes) for analysis, facilitating tasks such as rank computation and generation in combinatorial studies.

Other Permutation Codes

The provides an alternative approach to permutation representation by generating all permutations of n elements through a sequence of adjacent transpositions, effectively encoding each permutation as a path of swaps in the permutohedron graph where vertices are permutations and edges connect those differing by one adjacent swap. Unlike the Lehmer code's numerical inversion-based encoding, this method emphasizes minimal changes between successive permutations, making it suitable for iterative generation rather than direct mapping, with each step involving a single swap of neighboring elements directed by "mobility" rules that track element directions. Cycle notation encodes by decomposing them into disjoint , capturing the structure where each represents a closed of elements under the permutation mapping, such as (1\ 3\ 5)(2\ 4) for a permutation swapping elements in those loops. The Lehmer code connects to this representation by facilitating the computation of cycle types during enumeration, as its inversion counts can be transformed to reveal the cycle decomposition, aiding in counting with specific cycle structures like those with fixed numbers of of given lengths. Mixed radix systems generalize the underlying the Lehmer code, allowing variable bases for encoding permutations restricted to subsets or with constraints, such as k-permutations where not all elements are used; for instance, extensions of Lehmer encoding map integers bijectively to selections of k distinct elements from n in order, using adjusted to handle the reduced choices at each position. Lehmer code emerges as a special case when k = n and bases follow the sequence, but these generalizations enable compact representations for pattern-avoiding or bounded permutations without full factorial growth. Post-2000 developments in reflected Gray codes for permutations adapt the reflective —where a for n-1 elements is prefixed and reflected to build the n-element —to permutation listings that change only a few positions between consecutive entries, often via substring shifts or transpositions, contrasting Lehmer's static numerical focus by prioritizing low-Hamming-distance transitions for efficient traversal. These codes, surveyed in recent works, support applications like distributed permutation generation, where minimal changes reduce synchronization overhead compared to Lehmer's decoding requirements. In the 2020s, Lehmer codes have found application in for constructing permutation oracles, leveraging their compact integer-to-permutation to minimize usage in representing random for cryptographic analysis and query algorithms. This efficiency arises from encoding in O(n \log n) bits via the factorial system, allowing quantum circuits to simulate oracles with fewer resources than explicit decompositions, as demonstrated in frameworks emulating quantum operations through permutation-indexed states.

References

  1. [1]
    [PDF] Efficient Rank Aggregation via Lehmer Codes - arXiv
    Jan 28, 2017 · Lehmer codes, also known as inversion vectors, are vector representations of permutations in which each coordinate can take values not ...
  2. [2]
    [PDF] Permutation Coding for Vertex-Blend Attribute Compression
    These algorithms were described in more detail by. Lehmer [1960] and first proposed by his father in 1906. Thus, we call 𝜑(𝜎) a Lehmer code. The shuffling ...
  3. [3]
    Efficient Encoding Algorithms Based on the Lehmer Code - MDPI
    Oct 21, 2019 · Permutation entropy (PeEn) is in turn defined as the Shannon entropy [2,3] of a marginal probability distribution of such ordinal patterns.Missing: history | Show results with:history<|control11|><|separator|>
  4. [4]
  5. [5]
    [1701.09083] Efficient Rank Aggregation via Lehmer Codes - arXiv
    Jan 28, 2017 · The proposed Lehmer code approach may also be used on partial rankings, with similar performance guarantees. Subjects: Machine Learning (cs ...
  6. [6]
    Permutations - Combinatorics
    Summary of each segment:
  7. [7]
    Factorial numeral system - OeisWiki
    Lehmer code of a permutation. [edit]. A factoradic numeral corresponds to a permutation's Lehmer code. For example, the factoradic numeral 3:1:1! (3:1:1:0 ...
  8. [8]
    [PDF] The Lehmer factorial norm on Sn - arXiv
    Nov 6, 2021 · The Lehmer code of σ coincides with the factorial number system representa- tion of its position in the list of permutations of [n] in the ...
  9. [9]
    [PDF] Permutation Learning via Lehmer Codes - Ecai 2020
    We chose to format the Lehmer code in matrix form, which is simply the one- hot encoding of the vector itself. In a nutshell, given a tuple consist- ing of ...Missing: history | Show results with:history
  10. [10]
    [PDF] DETERMINANTAL FORMULAS FOR SEM EXPANSIONS OF ...
    The (Lehmer) code of a permutation w ∈ Sn is the sequence c = c(w)=(c1,...,cn), where ci = #{j>i | wj < wi}. The map from w ∈ Sn to its code c is a bijection.
  11. [11]
    [0808.0554] Ranking and Unranking of Hereditarily Finite Functions ...
    Aug 5, 2008 · The more difficult problem of {\em ranking} and {\em unranking} {\em Hereditarily Finite Permutations} is then tackled using Lehmer codes and ...Missing: enumeration | Show results with:enumeration
  12. [12]
    Ranking and unranking permutations in linear time | Request PDF
    Aug 6, 2025 · A ranking function for the permutations on n symbols assigns a unique integer in the range [0,n!−1] to each of the n! permutations.
  13. [13]
    [PDF] A Bibliography of Publications of Derrick Henry Lehmer - The Netlib
    Machine-independent FORTRAN coding of. Lehmer random number generators. Open ... Cambridge. University Press, Cambridge, UK, 1960. Lehmer:1960:MM. [Leh60c].Missing: Wis | Show results with:Wis
  14. [14]
    [PDF] Bijections for restricted inversion sequences and permutations with ...
    Motivated by the vast literature on pattern avoidance in permutations, there has been growing interest in the study of pattern avoidance in inversion sequences,.
  15. [15]
    [PDF] Length-Four Pattern Avoidance in Inversion Sequences
    Dec 30, 2021 · Classical pattern avoidance represents permutations using one-line no- tation π = π1 ···πn; an alternative representation for permutations is ...
  16. [16]
    itertools — Functions creating iterators for efficient looping — Python ...
    The permutation tuples are emitted in lexicographic order according to the order of the input iterable. If the input iterable is sorted, the output tuples will ...
  17. [17]
    Who Solved the Secretary Problem? - Project Euclid
    A simple problem that has come to be known today as the Secretary Problem, or the Marriage Problem. It has since been taken up and developed by many eminent ...Missing: Lehmer code<|control11|><|separator|>
  18. [18]
    [1804.06487] A Generalized Cover's Problem - arXiv
    Apr 17, 2018 · As in the secretary problem, this permutation is exposed in stages via the successive components of its Lehmer code.
  19. [19]
    [PDF] Random Permutations (Selected Topics in Probability 106935)
    version numbers (Lehmer code) are independent under p-shifted distribu- ... The secretary problem: the classical problem under the uniform distri- bution ...
  20. [20]
    [PDF] Who Solved the Secretary Problem? - Penn Math
    The secretary problem in its simplest form has the following features. 1. There is one secretarial position available. 2. The number n of applicants is known. 3 ...
  21. [21]
    [PDF] Permutation Generation Methods* ROBERT SEDGEWlCK
    The counter array in Hall's correspondence counts the number of inversions in the corresponding permutation and is called an inversion table. Inversion tables ...
  22. [22]
    Study of Lehmer Code and Inversion Table Encoding - SpringerLink
    Oct 5, 2021 · The Lehmer code associates a unique code to each permutation .
  23. [23]
    LehmerCodeFromPermutation | Wolfram Function Repository
    Wolfram Language function: Create the Lehmer code corresponding to a given permutation. Complete documentation and usage examples.
  24. [24]
    Johnson and Trotter algorithm - GeeksforGeeks
    Mar 29, 2024 · The Johnson and Trotter algorithm generates permutations by finding the largest mobile integer, swapping it with its adjacent, and changing ...Missing: encoding | Show results with:encoding
  25. [25]
    [2202.01280] Combinatorial Gray codes-an updated survey - arXiv
    Feb 2, 2022 · A combinatorial Gray code for a class of objects is a listing that contains each object from the class exactly once such that any two ...
  26. [26]
    [PDF] Combinatorial Gray codes—an updated survey
    Feb 2, 2022 · A combinatorial Gray code for a class of objects is a listing that contains each object from the class exactly once such that any two ...<|control11|><|separator|>
  27. [27]
    Quanton representation for emulating quantum-like computation on ...
    The Quanton uses permutations indexed by Lehmer codes and permutation-operators to represent quantum gates and operations. A generating function ...