Fact-checked by Grok 2 weeks ago

Factorial number system

The factorial number system, also known as the factoradic, is a mixed for representing natural numbers in which the place values are successive s (1!, 2!, 3!, and so on), and the in the position weighted by k! ranges from to k. Every positive has a unique representation in this system as n = \sum_{k=1}^{m} d_k \cdot k!, where $0 \leq d_k \leq k and d_m \neq 0, with the 0! place (value ) often omitted as its is always . For example, the number 2020 in factorial base is written as 2 4 4 0 2 0 (meaning $2 \cdot 6! + 4 \cdot 5! + 4 \cdot 4! + 0 \cdot 3! + 2 \cdot 2! + 0 \cdot 1!). The system was first introduced by in 1869 as a way to express natural numbers using factorial bases, providing a for integers. In 1888, Charles-Ange Laisant extended its application to permutations, demonstrating a between the numbers from 0 to n! − 1 in factorial representation and the elements of the Sn, which corresponds to all permutations of n objects in . This connection, often via the , allows the factorial system to encode permutations uniquely, where the digits indicate the positions of elements in the permutation. Key properties include the uniqueness of representations, proven by induction and the pigeonhole principle, ensuring no two distinct digit sequences yield the same number within the bounds of the digits. The maximum value representable with digits up to k! is (k+1)! − 1, matching the count of permutations of k+1 elements. Notable applications leverage this structure for combinatorial optimization, such as generating permutations sequentially to solve the traveling salesman problem (TSP), and in cryptography for error-detecting codes due to "forbidden" digit combinations that enhance noise resistance. The system also extends to fractional values in the unit interval and has been generalized to other polyadic bases.

Basic Concepts

Historical Background

The factorial number system originated in the late as a specialized designed for enumerating . It was first introduced by in 1869 as a way to express natural numbers using bases. The term "numération factorielle" and its application to were first described by French mathematician Charles-Ange Laisant in his 1888 paper, where he demonstrated a between numbers in factorial representation and in . Laisant's work focused on representing integers using bases to systematically classify based on their inversion counts, enabling a direct and unique mapping between numbers and permutation arrangements. The initial motivation behind this system was to adapt traditional to the combinatorial structure of , avoiding redundancy and facilitating efficient without exhaustive listing. By assigning each a unique representation, Laisant demonstrated applications in calculating determinants and arrangements, such as the 24 of four objects to integers from 0 to 23. This approach provided a compact for combinatorial analysis at a time when manual computation of large sets was prevalent. In the , the factorial number system evolved through advancements in combinatorial , particularly in the development of algorithms for generation and indexing. It gained formalization in works addressing efficient enumeration, such as those exploring mixed-radix representations for computational purposes. This progression built on Laisant's foundation, integrating the system into broader studies of combinatorial structures and . Today, it connects to modern combinatorial applications, including algorithmic generation of permutations in .

Definition and Notation

The factorial number system, also known as the factoradic system, is a positional that represents positive integers using factorials as place values. In this system, the position weights increase from right to left, with the rightmost position (index 1) having weight $1!, the next (index 2) having weight $2!, and the k-th position having weight k!. It operates as a mixed , where the for the k-th (from the right) is k+1, meaning the a_k in that satisfies $0 \leq a_k \leq k. This varying structure distinguishes it from fixed-base s like or , allowing each to accommodate a number of possible s equal to one more than its index. The value n of a number in this is given by n = \sum_{k=1}^m a_k \cdot k!, where m is the highest needed, a_m \neq 0, and the s satisfy the constraints above; the $0! is typically omitted as it always holds a_0 = [0](/page/0). notation writes the representation as the sequence a_m a_{m-1} \cdots a_2 a_1 (without separators or a ), directly corresponding to the . This , introduced by in 1869 and applied to permutations by Laisant in 1888, provides a unique representation for natural numbers.

Examples and Properties

Illustrative Examples

To illustrate the , consider the representations of small non-negative , where each place value corresponds to a (1! for the units place, 2! for the next, and so on), and the digit in the position for k! is constrained to range from 0 to k. The system provides a for each , with a mapping to numbers up to $3! = 6. The table below lists these representations, omitting the trailing 0! term (which is conventionally 0 for and equals 1 in value but carries no additional information).
DecimalFactorial Representation
00
11
210
311
420
521
6100
For instance, the number 5 in decimal is represented as 21 in the factorial system, computed as $2 \times 2! + 1 \times 1! = 2 \times 2 + 1 \times 1 = 4 + 1 = 5. Here, the digit 2 in the $2! place is the maximum allowed (\leq 2), and the digit 1 in the $1! place is also at its limit (\leq 1). A larger example is 23 in decimal, represented as 321 (or explicitly 3:2:1:0 including the 0! place, though the trailing 0 is often omitted). This expands to $3 \times 3! + 2 \times 2! + 1 \times 1! + 0 \times 0! = 3 \times 6 + 2 \times 2 + 1 \times 1 + 0 \times 1 = 18 + 4 + 1 + 0 = 23, with digits respecting the constraints ($3 \leq 3, $2 \leq 2, $1 \leq 1, $0 \leq 0). The digits are determined through successive division by the place values, selecting the largest possible value within each position's limit to ensure uniqueness and prevent carry-over ambiguities that occur in fixed-base systems when digits exceed their range. For 23, start with the $3! place: \lfloor 23 / 6 \rfloor = 3 (valid since \leq 3), remainder $23 - 18 = 5; then $2! place: \lfloor 5 / 2 \rfloor = 2 (\leq 2), remainder $5 - 4 = 1; then $1! place: \lfloor 1 / 1 \rfloor = 1 (\leq 1), remainder 0; and $0! place: 0. This greedy choice avoids equivalents like using a digit greater than the limit, which would require carrying over to higher places (e.g., $4 \times 3! = 24 = 1 \times 4!, but 4 exceeds the limit for $3!).

Key Properties

The factorial number system, also known as the factoradic system, possesses several fundamental mathematical properties that distinguish it from fixed-base numeral systems. One key attribute is the uniqueness of representation: every has a unique factoradic representation without leading zeros, where a number n is expressed as n = \sum_{k=1}^m a_k \cdot k! with $0 \leq a_k \leq k and a_m \neq 0. This uniqueness is established through a that selects the largest possible a_k at each step while respecting the digit bounds, ensuring no two distinct sequences yield the same value, as proven by using the bounded coefficients. Complementing this is the system's completeness, which guarantees that every can be represented exactly. Specifically, all integers from 0 to (m+1)! - 1 are precisely representable using at most m digits, with the total count of such representations equaling (m+1)!, achieved via the and induction on the factorial bases. For illustration, the number 5 is represented as $2:1 (i.e., $2 \cdot 2! + 1 \cdot 1!), fitting within the bounds for two digits. A distinctive number-theoretic property involves prime numbers: all primes greater than 3 terminate in either \dots 0:1 or \dots 2:1 in their factoradic representation, serving as a modulo 6 (with $0:1 for primes congruent to 1 mod 6 and $2:1 for those congruent to 5 mod 6). This pattern stems from the divisibility properties enforced by the factorial bases, excluding other low-digit endings for composites. Finally, the system's rigid digit limits confer strong resistance, enabling high-probability detection in transmitted representations. For an 8-digit factoradic number, the probability of detecting an (assuming and single-digit corruption leading to invalid bounds) reaches up to 0.998, far surpassing many fixed-base systems due to the constrained valid sequences.

Conversion Methods

Encoding ( to Factoradic)

To convert a non-negative n to its factoradic representation, employ a that identifies starting from the highest place value. Determine the largest k such that k! \leq n; the a_k is then \lfloor n / k! \rfloor, which satisfies $0 \leq a_k \leq k. Update n to the n \mod k! and repeat the process for (k-1)! down to $1!, yielding a_k a_{k-1} \dots a_1. This method ensures each digit adheres to the positional constraints of the factorial base, where the place value for a_j is j! and the maximum digit value is j. For illustration, apply the steps to n = 21:
  • The largest k is 3, as $3! = 6 \leq 21 < 24 = 4!.
  • a_3 = \lfloor 21 / 6 \rfloor = 3, remainder $21 \mod 6 = 3.
  • For $2!, a_2 = \lfloor 3 / 2 \rfloor = 1, remainder $3 \mod 2 = 1.
  • For $1!, a_1 = \lfloor 1 / 1 \rfloor = 1, remainder $1 \mod 1 = 0.
The resulting factoradic representation is $311_! (digits for positions 3, 2, 1). The following pseudocode outlines the algorithm:
function decimal_to_factoradic(n):
    if n == 0:
        return []  // empty or [0] representation
    digits = []
    k = 1
    while [factorial](/page/Factorial)(k) <= n:
        k += 1
    k -= 1  // largest k with k! <= n
    while k >= 1:
        fact_k = [factorial](/page/Factorial)(k)
        a_k = floor(n / fact_k)
        digits.append(a_k)  // prepend if building MSB first
        n = n % fact_k
        k -= 1
    return digits  // e.g., [3, 1, 1] for n=21
Precomputing factorials up to a reasonable k (e.g., via dynamic programming) optimizes repeated calls, as factorials grow rapidly. For the edge case n = [0](/page/0), the representation consists of no digits or a single zero, as there are no non-zero coefficients needed. If n < 1! (i.e., n = [0](/page/0)), the process terminates immediately with the zero representation. This algorithm produces a unique factoradic form for every non-negative integer.

Decoding (Factoradic to Decimal)

To convert a number from its factoradic representation back to decimal, evaluate the positional sum where each digit is multiplied by the factorial of its position index, starting from the rightmost digit as position 1 (corresponding to $1!). The factoradic representation is typically written as a sequence of digits a_m : a_{m-1} : \dots : a_1, where the leftmost digit a_m is the coefficient for m! and the rightmost a_1 for $1!; the $0! place (always 0) is omitted. The digits satisfy $0 \leq a_k \leq k for each position k. The decimal equivalent n is computed as n = \sum_{k=1}^m a_k \cdot k! To perform the decoding, follow these steps:
  1. Identify the positions: Assign the rightmost digit to $1!, the next to the left to $2!, and so on, up to the leftmost digit for m!.
  2. Compute each term: Multiply each digit by the factorial of its position (e.g., for the representation 3:2:1:0, treat it as a_3=3 for $3!, a_2=2 for $2!, a_1=1 for $1!, and a_0=0 for $0!, yielding $3 \times 6 + 2 \times 2 + 1 \times 1 + 0 \times 1 = 18 + 4 + 1 + 0 = 23).
  3. Sum the terms to obtain n.
Trailing zeros in the $0! place are always omitted in standard notation, as a_0 = 0 by definition, ensuring unique representations without redundancy. Leading zeros do not appear, as the highest digit a_m is chosen such that $1 \leq a_m \leq m. For example, consider the factoradic number 3:1:1, corresponding to positions $3!, $2!, and $1!: n = 3 \times 3! + 1 \times 2! + 1 \times 1! = 3 \times 6 + 1 \times 2 + 1 \times 1 = 18 + 2 + 1 = 21. This summation directly yields the decimal value, leveraging the mixed-radix structure of the system.

Applications in Combinatorics

Relation to Permutations

The factorial number system establishes a bijection between the integers from 0 to m! - 1 and the m! permutations of a set of m distinct elements, ordered lexicographically. This mapping, first described by in 1888, allows each integer n in this range to uniquely correspond to one permutation, facilitating systematic enumeration and indexing of all possible arrangements. In this representation, the factoradic digits of n, denoted as n = a_{m-1} \cdot (m-1)! + \cdots + a_1 \cdot 1! + a_0 \cdot 0! where $0 \leq a_k \leq k, directly indicate selections from the remaining elements at each step. Specifically, the digit a_k specifies the position (0-based index) of the element to choose for the (m-k)-th position in the permutation, from the list of unused elements sorted in increasing order. This process builds the permutation sequentially: begin with the full sorted list of elements, select the a_{m-1}-th remaining element for the first position, remove it, then select the a_{m-2}-th from the updated list for the second position, and continue until all positions are filled. To illustrate, consider m=4 and n=21, with elements \{1, 2, 3, 4\} and factoradic representation $21 = 3 \cdot 3! + 1 \cdot 2! + 1 \cdot 1! + 0 \cdot 0!, so digits a_3=3, a_2=1, a_1=1, a_0=0. Start with available list [1, 2, 3, 4]: select index 3 (element 4) for the first position, leaving [1, 2, 3]; select index 1 (element 2) for the second, leaving [1, 3]; select index 1 (element 3) for the third, leaving {{grok:render&&&type=render_inline_citation&&&citation_id=1&&&citation_type=wikipedia}}; select index 0 (element 1) for the last. The resulting permutation is $4, 2, 3, 1, which is the 21st (0-based) in lexicographic order. This bijection enables efficient generation and traversal of all m! permutations without redundancy or omission, by incrementing n from 0 to m! - 1 and converting each to its corresponding permutation via the digit-based selection algorithm. Such indexing is particularly useful in combinatorial algorithms requiring ordered access to permutations, as it avoids explicit storage of all arrangements.

Lehmer Codes

The Lehmer code encodes a permutation of n elements using the factorial number system, where each digit corresponds to the number of inversions involving the element at a specific position. Specifically, for a permutation \pi = (\pi_1, \pi_2, \dots, \pi_n), the digits a_k (for k = 1 to n) are defined such that a_k counts the number of positions j < k where \pi_j > \pi_k, representing the larger elements to the left of \pi_k. These digits satisfy $0 \leq a_k < k, ensuring a unique factoradic representation. The sequence of these inversion counts forms the Lehmer code, often written in reverse order (from a_n to a_1) to align with the factorial bases from highest to lowest place value. For a permutation \pi, the code is computed by iterating through each position k and tallying the qualifying left inversions, yielding the factoradic digits directly. This construction establishes a bijection between permutations and factoradic numbers from 0 to n! - 1. The Lehmer code of a permutation corresponds precisely to its index in the lexicographic ordering of all permutations, where the factoradic value gives the position starting from 0. For example, consider the permutation \pi = (3, 1, 4, 2) of \{1, 2, 3, 4\}:
  • At position 1 (\pi_1 = 3): 0 larger elements to the left.
  • At position 2 (\pi_2 = 1): 1 larger element (3 > 1).
  • At position 3 (\pi_3 = 4): 0 larger elements ().
  • At position 4 (\pi_4 = 2): 2 larger elements (3 > 2, 4 > 2).
The inversion counts are thus 0, 1, 0, 2 from positions 1 to 4. The , listed as digits from highest to lowest base, is 2:0:1:0, equivalent to the factoradic number $2 \cdot 3! + 0 \cdot 2! + 1 \cdot 1! + 0 \cdot 0! = 13, confirming its rank in . This encoding compresses permutation information into a compact of small integers, facilitating efficient (assigning a unique ) and unranking (generating the from an index) operations without needing to store or generate the full of elements.

Further Extensions

Fractional Values

The factorial number system extends naturally to real numbers by incorporating a fractional part beyond the radix point, where the place values are defined using reciprocals of factorials starting from 2!. Specifically, the k-th fractional position corresponds to the weight 1/(k+1)!, for k = 1, 2, 3, ..., since negative factorials are undefined in the standard sense. A is thus represented as an integer part n (in factorial base) followed by the radix point and digits b_1 b_2 b_3 \dots, yielding the value x = n + \sum_{k=1}^{\infty} \frac{b_k}{(k+1)!}, where each digit satisfies $0 \leq b_k \leq k. This variable upper bound on digits mirrors the integer part's structure but adapts to the decreasing place values for convergence. Rational numbers in this system exhibit behaviors analogous to those in fixed-base representations like decimal. If the denominator of a reduced rational fraction divides some factorial m!, its representation terminates after at most m fractional digits, as the remaining places can be zero. Other rationals possess non-terminating expansions, which are typically infinite and may repeat periodically, reflecting the system's ability to approximate any real through the factorial series. For instance, the rational 1/3 admits the terminating representation 0:0 2, computed via the greedy algorithm: multiplying 1/3 by 2 yields a fractional part less than 1 (digit b_1 = 0), then multiplying the remainder by 3 gives exactly 2 (digit b_2 = 2), with all subsequent digits zero. The value is \frac{0}{2!} + \frac{2}{3!} = \frac{2}{6} = \frac{1}{3}. This example illustrates convergence and exactness for terminating cases. Uniqueness of representations follows from the digit constraints: irrationals have a single infinite expansion, while rationals have dual forms—one finite and one infinite (e.g., ending in a tail of maximum digits, akin to 0.4999\dots = 0.5 in decimal). By convention, preferring the terminating form when available ensures a unique representation for every real number, avoiding ambiguities inherent in fixed-base systems.

Modern Applications

The factorial number system enables robust detection and -resistant due to its strict constraints, where each d_k satisfies $0 \leq d_k \leq k, making invalid representations easily identifiable as s. This property allows for high detection rates in data transmission; for instance, in an 8- factorial code, the probability of detecting an introduced by is approximately 99.8%, as only valid permutations correspond to legitimate codes while the vast majority of altered sequences are forbidden. Such schemes integrate correction with permutation-based recovery, providing comprehensive protection against transmission s in noisy channels. In , the system supports noise-immune encryption through factorial-based ciphers that leverage indexing for secure . Permutations derived from representations serve as keys, decomposed into disjoint cycles to ensure unique and resistance to unauthorized decryption, even in insecure environments without dedicated channels. For example, a based on the S_n encodes messages as permutations via the system, encrypts them using powers of a generator permutation, and decrypts with private exponents, offering a between integers and permutations for efficient, secure operations. These methods combine with inherent error tolerance, suitable for applications in secure communications. The factorial number system facilitates efficient enumeration in optimization problems, such as the traveling salesman problem (TSP), by enabling sequential generation of permutations without exhaustive . This approach systematically indexes routes as factorial numbers, allowing targeted evaluation of promising paths and outperforming traditional methods in for combinatorial routing tasks. In , it simplifies interval searches over permutation spaces, supports universal solvers for broader combinatorial problems by providing a natural ranking mechanism, and aids in representing and querying ranked data structures like ordered lists or trees. Recent developments, including a 2024 study on mixed-base factorial systems, highlight enhanced applications in secure communications and , with factorial numbers enabling ratios up to 1.745 for short sequences and improved resistance in applied sciences. These advances underscore the system's growing role in integrating combinatorial encoding with practical computational challenges.

References

  1. [1]
    [PDF] Generalized Number Systems and Application to Hyperoctahedral ...
    Nov 13, 2014 · Cantor seems to be the first to introduce the factorial number system in [3]. Then, Laisant. (cf [5]) introduce a code by associating each ...
  2. [2]
    [PDF] THE FACTORIAL NUMBER SYSTEM In this note we give ... - Poisson
    In this note we give a brief introduction to the factorial number system, proving existence and uniqueness of the factorial representation of positive integers.
  3. [3]
    Sur la numération factorielle, application aux permutations - Numdam
    Laisant, C.- A. Bulletin de la Société Mathématique de France, Tome 16 (1888), pp. 176-183.<|control11|><|separator|>
  4. [4]
  5. [5]
    [PDF] Permutation Generation Methods* ROBERT SEDGEWlCK
    This paper surveys the numerous methods that have been proposed for permutatmn enumeration by computer. The various algorithms which have been developed ...
  6. [6]
    [PDF] A Cryptosystem Based on the Symmetric Group Sn
    A. S and n respectively. 3.1 Factoradic: A Mixed Radix Number System. A number system is a framework for representing numerals. Number systems can be divided ...
  7. [7]
    Factorial Numbers and Their Practical Applications - MDPI
    Sep 24, 2024 · The ability to obtain permutations based on factorial numbers means that they can be used to solve the traveling salesman problem by sequential ...
  8. [8]
    [PDF] arXiv:1912.02044v1 [math.NT] 4 Dec 2019
    Dec 4, 2019 · In this paper we consider a mixed radix number system known as the factoradic number system, also called the factorial number system. Given ...
  9. [9]
    Factorial numeral system - OeisWiki
    The factorial numeral system, also called factoradic, a mixed radix numeral system adapted to numbering permutations in lexicographic order or in reverse ...
  10. [10]
    factorial base - PlanetMath.org
    Mar 22, 2013 · For example, the integer which is represented in base 10 as 47 (because 4⋅101+7⋅100 4 ⋅ 10 1 + 7 ⋅ 10 0 ) is represented in factorial base as ...Missing: system | Show results with:system<|control11|><|separator|>
  11. [11]
    [PDF] On the Permutations Generated by Cyclic Shift
    Charles-Ange Laisant showed in 1888 [2] that the factorial number system codes the permutations generated in lexicographic order. More precisely, when the ...
  12. [12]
    [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 ...
  13. [13]
    Factoradic Representation for Permutation Optimisation - CMAP
    In this paper, we present a study of the factoradic representation which offers new modelling insights through the use of three algorithmic frameworks, a ...
  14. [14]
    [PDF] Indexing Large Permutations in Hardware - VTechWorks
    May 9, 2019 · The Factorial. Number System provides a convenient way to number, or index, permutations and will be used as such throughout this thesis. You ...
  15. [15]
  16. [16]
    Efficient Encoding Algorithms Based on the Lehmer Code - MDPI
    Oct 21, 2019 · The present article focusses on the computational problem of turning time series into sequences of ordinal patterns.Missing: reverse | Show results with:reverse
  17. [17]
  18. [18]
    [PDF] Cryptographic Key Exchange Method for Data Factorial Coding
    Abstract. The paper proposes a new cryptographic key exchange method. The basic idea of the proposed method is to use a permutation of a given set as a.