Factoradic Converter — Factorial Number System & Lehmer Code
Convert any non-negative integer to and from the factorial number system (factoradic), where each place i has weight i! and its digit ranges 0…i. See the digits, the positional expansion, the repeated-division steps, and the permutation (Lehmer code) the number selects — live, in your browser.
How to Use
- Pick your input direction: a decimal integer, or factoradic digits.
- Type the value — the other representation, the positional expansion and the steps update instantly.
- Read the digits colon-separated (e.g. 3:4:1:0:1:0), highest place first.
- Scroll to the permutation panel to see the Lehmer code — the ordering of {0,1,…,n} this number indexes.
- Click any value (or its Copy button) to copy it.
The factorial number system, explained
The factoradic (or factorial base) is a mixed-radix number system: instead of every place sharing one base, the place value of position i — counting from the right starting at 0 — is the factorial i!. The place values run 0!, 1!, 2!, 3!, 4!, 5!, … = 1, 1, 2, 6, 24, 120, … The digit in place i is allowed to range only from 0 up to i, so the rightmost digit is always 0, the next at most 1, the next at most 2, and so on. Every non-negative integer has exactly one factoradic representation, which makes it a tidy way to enumerate things that grow factorially — most famously, permutations.
Converting both ways, by hand
Decimal → factoradic uses repeated division by an increasing divisor. Divide the number by 1 and keep the remainder (always 0), divide the quotient by 2 and keep the remainder, then by 3, then 4, and so on until the quotient reaches 0; the remainders read from last to first are the digits. For 463: 463÷1 = 463 r0, 463÷2 = 231 r1, 231÷3 = 77 r0, 77÷4 = 19 r1, 19÷5 = 3 r4, 3÷6 = 0 r3 → reading up gives 3:4:1:0:1:0. Factoradic → decimal is the positional expansion: multiply each digit by the factorial of its place and add — 3·5! + 4·4! + 1·3! + 0·2! + 1·1! + 0·0! = 463.
Factoradic and permutations (the Lehmer code)
Factoradic numbers index permutations in lexicographic order. Read the digits as a Lehmer code: starting from the sorted list {0, 1, …, n}, each digit says which remaining element to pick by its position in what is left. The integer k therefore selects the k-th permutation (0-indexed) in dictionary order, and the mapping is a bijection — every integer ⇄ one permutation. That is why “find the k-th permutation sequence” problems reduce to a factoradic conversion. The tool shows the permutation of {0,…,n} your number selects and confirms it converts straight back.
Quick reference
About the Factoradic Converter — Factorial Number System & Lehmer Code
Whether you are at a desk or on your phone, the Factoradic Converter — Factorial Number System & Lehmer Code makes everyday tasks easy — and it is completely free. Convert any non-negative integer to and from the factorial number system (factoradic), where each place i has weight i! and its digit ranges 0…i. See the digits, the positional expansion, the repeated-division steps, and the permutation (Lehmer code) the number selects — live, in your browser.
How it works
Enter a number and choose your units — the converted value shows instantly. Everything runs locally, so nothing you type leaves your device. Double-check the direction of the conversion and you are set.
Want the deeper story? The Knowledge Base explains the ideas behind the tools in more detail.
Frequently Asked Questions
What is the factorial number system?
It is a mixed-radix system where the place value of position i (counting from the right, starting at 0) is i! rather than a fixed base raised to a power. So the place values are 0!, 1!, 2!, 3!, … = 1, 1, 2, 6, 24, 120, … The digit in place i may range from 0 up to i, which is why the rightmost digit is always 0 and the system is sometimes written omitting it.
How do I convert a decimal number to factoradic?
Divide repeatedly by increasing divisors. Divide n by 1 and record the remainder (always 0); divide the quotient by 2 and record the remainder; divide by 3, then 4, and so on, until the quotient is 0. Reading the remainders from last to first gives the factoradic digits. For example 463 → 3:4:1:0:1:0.
How do I read factoradic back to decimal?
Multiply each digit by the factorial of its place and add. For 3:4:1:0:1:0 that is 3·5! + 4·4! + 1·3! + 0·2! + 1·1! + 0·0! = 360 + 96 + 6 + 0 + 1 + 0 = 463.
What is the Lehmer code / permutation connection?
Factoradic numbers index permutations in lexicographic order. Treat the factoradic digits as a Lehmer code: for an (n+1)-digit code, the digit at each place tells you which item to pick (by index) from the remaining sorted elements of {0,1,…,n}. The k-th permutation in lexicographic order is exactly the one whose Lehmer code is the factoradic of k. This tool shows that permutation and confirms it round-trips.
What are the limits?
Only non-negative integers have a factoradic form (there is no factoradic for negatives or fractions here). The math uses BigInt, so values are limited only by your browser memory — millions of digits are fine, though the permutation grows as the number of digits.
Is anything uploaded?
No. The whole conversion runs in your browser with JavaScript — nothing is sent to a server.
How do I use the Factoradic Converter — Factorial Number System & Lehmer Code?
Simply type or paste your value and read the result, which refreshes the instant you change something. There is nothing to submit and nothing to wait for.
Is it free? Does it work without internet?
Yes to both. It is free with no sign-up, and once the page has loaded it keeps working even with no internet.
Where does my data go?
Nowhere — every calculation runs on your own device. Nothing you enter is uploaded, logged, or stored.
Common Use Cases
Ranking & unranking permutations
Turn an index into the k-th permutation of a set (and back) in lexicographic order — the core of combinatorial unranking via the Lehmer code.
Learning mixed-radix systems
See a clean example of a non-uniform base: every place has a different radix, with the working spelled out.
Algorithm puzzles
Many interview and contest problems (next/previous permutation, “find the k-th permutation sequence”) are direct applications of factoradic.
Combinatorics homework
Check factoradic conversions and Lehmer-code permutations step by step instead of by hand.
Last updated: