Factoradic Calculator (Factorial Number System)

Number Theory

Factoradic conversion3 4 1 0 1 0
Digits3 4 1 0 1 0
Highest place5!
How this was calculated
  1. Divide repeatedly: 463 leaves remainders (from the 1! place up) of 1, 0, 1, 4, 3.
  2. Reading the remainders from the highest place down, and appending the always-zero 0! digit, gives the factoradic digits (written here with spaces between digits).
  3. So 463 in factoradic is 3 4 1 0 1 0 (places 5! down to 0!).
  4. Check: the digits weighted by factorials sum back to 463.

Every number system you have ever used keeps the same base everywhere - tens, twos, sixteens. The factorial number system, or factoradic, does something stranger: the place values grow as factorials. Reading right to left, the places are 0!, 1!, 2!, 3!, 4!... worth 1, 1, 2, 6, 24..., and the digit allowed at each place is capped - the digit at the k! place may be anything from 0 to k. This calculator converts in both directions.

The flagship example: 463 in factoradic is 3 4 1 0 1 0 (digits shown spaced on this page). That is 3 x 5! + 4 x 4! + 1 x 3! + 0 x 2! + 1 x 1! + 0 x 0! = 360 + 96 + 6 + 0 + 1 + 0 = 463. The largest tidy example is 719 = 5 4 3 2 1 0, where every digit sits at its maximum.

Factoradics are not a curiosity for their own sake: read as instructions, the digits of a factoradic form the Lehmer code of a permutation, giving a perfect numbering of all orderings - the n-th permutation of a list is found by writing n in factoradic. Ranking and unranking permutations this way is used in combinatorics, testing and algorithm design.

A concrete way to see the system working: the factoradic 1 0 0 0 (places 3! to 0!) is worth 6, and counting upward runs 0 0 0 0, 0 0 1 0, 0 1 0 0, 0 1 1 0, 0 2 0 0... - each place rolls over at its own cap, exactly like an odometer whose wheels have different sizes: 2 notches, then 3, then 4. That irregular odometer is the whole system in one image.

Worked examples

463 in factoradic

(Number to factoradic · 463)

Factoradic conversion3 4 1 0 1 0
Digits3 4 1 0 1 0
Highest place5!

719 in factoradic

(Number to factoradic · 719)

Factoradic conversion5 4 3 2 1 0
Digits5 4 3 2 1 0
Highest place5!

Factoradic 341010 as a number

(Factoradic to number · 341010)

Factoradic conversion463
Decimal value463
Places5! to 0!

How the factorial number system works

A factoradic representation is a mixed-radix numeral: the radix changes from place to place. The rightmost place (0!) can only hold 0 - a deliberate quirk that keeps representations unique. The 1! place holds 0-1, the 2! place 0-2, and so on. With places up to k! you can represent every integer from 0 to (k+1)! - 1 exactly once.

Uniqueness is the point of the digit caps: without them, 2 at the 1! place would collide with 1 at the 2! place. The caps make factoradic a true positional system, with the same one-number-one-string property as decimal.

Converting decimal to factoradic

Divide repeatedly by 2, 3, 4, 5... and keep the remainders. For 463: 463 divided by 2 leaves 1; 231 by 3 leaves 0; 77 by 4 leaves 1; 19 by 5 leaves 4; 3 by 6 leaves 3. The remainders, read in reverse and followed by the obligatory final 0, are the digits: 3 4 1 0 1 0.

The calculator performs exactly this division chain and shows it in the steps, so the conversion is auditable digit by digit. Notice that the divisor at each step is one more than the place index - dividing by (k+1) extracts the digit for the k! place.

Converting factoradic back to decimal

Reverse mode multiplies each digit by its factorial place value and sums: for 3 4 1 0 1 0 that is 3 x 120 + 4 x 24 + 1 x 6 + 0 x 2 + 1 x 1 + 0 x 1 = 463. The calculator also validates the digits: a digit larger than its place index - a 3 at the 2! place, say - is not a legal factoradic, and the page says so rather than silently computing a meaningless sum.

When you type a factoradic into the reverse mode, enter it as a plain run of digits (341010 for the example above); the calculator splits it into single digits, which is why factoradic input on this page is limited to places up to 9! - beyond that, digits can exceed 9 and a plain digit string becomes ambiguous.

Lehmer codes and permutations

Write n in factoradic and read the digits as a recipe: at each step, the digit says how far into the remaining list of unused elements to reach. Applying the digits of 463 (3 4 1 0 1 0) to the list [0,1,2,3,4,5] generates the 463rd permutation of six elements in lexicographic order. Every number from 0 to 6! - 1 = 719 names exactly one permutation, and every permutation has exactly one number.

This is how software generates a specific permutation without generating all of them, how combinatorial objects are ranked in enumeration algorithms, and how some puzzle and shuffle analyses count positions. The factoradic is the bridge between a permutation and its index.

Why the last digit is always 0

The 0! place has value 1 - the same as the 1! place - which looks redundant, and its digit is therefore frozen at 0 to keep representations unique. Many authors omit it and write factoradics ending at the 1! place; this page keeps it, because the full form makes the place pattern (each digit capped by its index, counting down to 0) visible at a glance.

Either convention converts to the same number; if you compare with a source that writes 463 as 34101, that is the same representation with the trailing zero dropped.

Factoradic versus ordinary bases

In base b, n digits represent b^n values with uniform places. In factoradic, k places represent (k+1)! values - factorial growth beats exponential growth, so factoradics are compact: places 0! through 9! already cover 10! = 3,628,800 values, 0 through 3,628,799. The cost is the irregular place values, which is why factoradic never became an everyday notation - it is a specialist tool for permutation-shaped problems.

That specialisation is complete: wherever a problem is secretly about orderings - shuffles, rankings, tournament draws, anagram indices - the factorial number system is usually the natural language for it.

Factoradics and inversion vectors

Read differently, the factoradic digits of a permutation's index form its inversion vector - the count, for each position, of how many smaller unused elements were skipped. Inversion vectors appear in sorting analysis (their sum is the inversion count, a measure of how unsorted a list is) and in the theory of permutations as a coordinate system alternative to cycle notation.

The calculator's two modes are the two directions of this dictionary: number to digits is 'what are the coordinates of this permutation', digits to number is 'which permutation has these coordinates'. Anyone implementing permutation ranking in software is, knowingly or not, using this page's arithmetic.

Historical note

Mixed-radix systems are old - time (60, 60, 24) and pre-decimal currency are everyday examples - and the factorial system was described in essence by early combinatorists counting arrangements. The modern name and notation settled in the twentieth century as combinatorics formalised, and the Lehmer code connection made it a standard tool once computing made permutation generation a practical problem.

It remains a niche system, but a perfectly formed one: it is the unique positional system whose place values count the permutations of growing sets, which is why it keeps being rediscovered by each generation of programmers who meet ranking problems.

FAQs

What is 463 in factoradic?

3 4 1 0 1 0 - the digits for places 5! down to 0!, worth 3 x 120 + 4 x 24 + 1 x 6 + 0 x 2 + 1 x 1 + 0.

How do you convert factoradic back to decimal?

Multiply each digit by its factorial place value and add the products.

Why is the last factoradic digit always 0?

The digit at the 0! place may not exceed its place index, which is 0 - so it is always 0.

What is the largest digit allowed at the 5! place?

5 - a factoradic digit may equal but never exceed its place index.

Where are factoradics used?

In Lehmer codes, which number the permutations of a list: the factoradic digits of n generate the n-th permutation.

What is 719 in factoradic?

5 4 3 2 1 0 - every digit at its maximum, since 719 = 6! - 1.

Sources

Related calculators

Factorial Calculator
Exact factorials up to 170! computed with arbitrary-precision integers — no scientific-notation rounding — with the digit count and trailing zeros (Legendre's formula) explained.
Double Factorial Calculator
Double factorial n!! for even and odd n, with the full factor chain, the ordinary factorial for comparison and the opposite-parity companion value.
Integer Partition Calculator
Exact partition count p(n) up to n = 200 by Euler's pentagonal recurrence, with p(n-1), the growth ratio and the partitions into distinct parts.