Factorial number system converter
Convert whole numbers to factoradic and back: 23 is 3:2:1:0, also written 3210!, because three times 3! plus two times 2! plus one times 1! adds up to 23. Every place is checked against its digit limit. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Value
- 23
- Value
- 23
- Calculation mode
- To factoradic
- Input
- 23
- Decimal
- 23
A factorial number system converter turns non-negative integers into factoradic digits and back again, using place values that are successive factorials instead of powers of a fixed base. Students learning positional notation, contest solvers working with Lehmer codes, and engineers ranking permutations all need the same deterministic path: no network, no random seeds, no wall-clock dependence.
What the factorial number system (factoradic) is
The factorial number system, often called factoradic notation, is a mixed-radix place-value system in which the place with index k has weight equal to k factorial and may only carry a digit d sub k that satisfies zero less than or equal to d sub k less than or equal to k. The least significant place is always zero factorial, so its only legal digit is zero; the next place is one factorial with digits zero or one; then two factorial with digits zero through two; and so on.
Any non-negative integer has a unique factoradic representation under that digit bound, just as every integer has a unique base-ten form. A classic example is decimal twenty-three, which expands as three times three factorial plus two times two factorial plus one times one factorial plus zero times zero factorial, written as the digit sequence three-two-one-zero or compactly as three-two-one-zero bang. The same uniqueness is why factoradic indexing underpins permutation ranking: the Lehmer code of a permutation is essentially a factoradic integer that enumerates all n-factorial orderings without gaps or collisions.
Converting by hand is tedious past a few places because you must compute successive factorials, take remainders against increasing moduli, and re-check the digit bound at every place. A deterministic converter removes that bookkeeping while still publishing the place-value expansion so learners and test authors can audit the arithmetic.
Practical tips, limits, and related searches
Always set mode explicitly when a string could be misread: a bare twenty-three is a decimal integer for encoding, while three-colon-two-colon-one-colon-zero is a digit list for decoding, and the tool never auto-detects by guessing. Prefer sending a string even when the value looks numeric; bare numbers are accepted only as finite whole numbers within the safe integer range as a convenience for small inputs. Do not embed fractional points or exponent markers; strip grouping characters in your client before calling if your source uses underscores or thousands separators.
Forty places bound work without silent truncation; longer factoradics are rejected rather than cut. Prefer this capability when you already have an integer rank or a factoradic digit list and only need the other form; if you need prime factors of n factorial, use that dedicated capability instead.
What you can do with it
Homework checks for factoradic place value
Students enter short non-negative integers or digit lists from worksheets and compare hand-written k! expansions and digit bounds against a deterministic result before submitting.
Permutation ranking and Lehmer-code pipelines
Contest and combinatorics pipelines convert ranks to factoradic digits (or the reverse) without reimplementing successive-remainder logic in every language.
FAQ
What is the factorial number system (factoradic)?
It is a mixed-radix system where place k has weight k! Every non-negative integer has a unique factoradic representation under that rule.
Why is the least significant digit always 0?
The 0! place only allows digit 0, so the rightmost digit in classic bang notation is always zero. The conversion algorithm produces that digit automatically.
Is the factoradic converter free?
The browser tool is free and runs locally.
How do I convert 23 to factoradic by hand?
Divide by 1, 2, 3 and so on, keeping each remainder and carrying the quotient forward. For 23 the remainders are 0, 1, 2 and 3; read from last to first they give 3:2:1:0.
How is factoradic used to rank permutations?
The Lehmer code of a permutation is essentially a factoradic number, so each of the n! orderings of n items gets its own rank with no gaps and no collisions. Converting a rank to factoradic gives its Lehmer code, and back.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/enc/factoradic \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"value":"23"}'const res = await fetch("https://api.kit.forhosting.com/enc/factoradic", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"value": "23"
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/enc/factoradic",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"value": "23"
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/enc/factoradic", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"value":"23"}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"value":"23"}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/enc/factoradic", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"value": "23"
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "enc.factoradic",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
max_places | 40 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
Enter a decimal integer such as twenty-three with mode set to to_factoradic, or a colon-separated digit string such as three-colon-two-colon-one-colon-zero with mode set to from_factoradic; the tool validates every place so that digit d sub k never exceeds k, expands the sum of d sub k times k factorial, and returns both the decimal value and the classic bang notation used in permutation ranking. Negative values, fractions, scientific notation, and illegal place digits raise a clear invalid_input error instead of a silent wrong rank.
What the factorial number system (factoradic) is
If any digit violates the bound for its place, conversion stops with invalid_input—there is no best-effort parse that clamps digits or invents a different radix.
How to call the API and what comes back
Send a JSON body with one required string field value (aliases n, input, text, number, digits, and factoradic) and an optional mode field that defaults to to_factoradic. Set mode to to_factoradic, encode, or decimal when value is a non-negative base-ten integer; set mode to from_factoradic, decode, or factoradic when value is an MSB-first factoradic digit string. Digit strings may use colons, spaces, or commas as separators (for example three-colon-two-colon-one-colon-zero), or the compact bang form three-two-one-zero bang when every place fits a single character and there are at most ten places; digit arrays are also accepted for from_factoradic. Absolute place count is capped at forty so Worker and browser responses stay bounded. On success the response sets mode to the normalized direction, echoes input, sets value and decimal to the integer as a JSON number when it fits Number.MAX_SAFE_INTEGER or as a decimal digit string when it does not, decimal_string always to the full decimal text, digits and digits_msb to the MSB-first array, digits_lsb to the least-significant-first array used by the remainder algorithm, factoradic to the colon-joined form, factoradic_bang to the classic bang spelling when compact, places to an array of digit, place, factorial, contribution, and label rows, place_count to the number of places, expansion to a short sum of labels, formula to the defining sum, message to a one-line English summary, and steps to an ordered list that records parsing, validation, and the expansion. Failed validation—missing value, negatives, fractions, scientific notation, empty digit lists, more than forty places, or any digit outside zero through k at place k—returns invalid_input and is never charged. Pricing is a flat $0.002 per successful request with unit item and zero marginal unit price.
Practical tips, limits, and related searches
For magnitudes larger than Number.MAX_SAFE_INTEGER the value and decimal fields may be strings so no mantissa rounding can corrupt low bits—always prefer decimal_string when you need a stable textual form across languages. When teaching, pair examples: decimal twenty-three maps to factoradic three-two-one-zero, factoradic one-zero-zero-zero-zero maps to decimal twenty-four, and a digit three in the two-factorial place yields invalid_input so students see the hard error path. This landing targets people searching for a factoradic converter, factorial number system calculator, permutation rank helper, or Lehmer-code digit check; it is not a general arbitrary-base converter, not a factorial-prime-factor tool, and not a full permutation generator that emits the ranked sequence of items. Failed tasks that return invalid_input do not consume prepaid balance, which keeps exploratory scripts cheap when you fuzz illegal place digits. Round-trip checks are easy: convert a known decimal to factoradic, then convert the factoradic string back with mode set to from_factoradic, and confirm that decimal_string matches the original integer, then confirm that raising one digit past its place bound flips the response to invalid_input with a message that names the bad place.
Integration use cases
Unit tests for mixed-radix libraries
Generate known-good decimal↔factoradic pairs plus deliberate out-of-bound digit cases so coding kata expected values stay stable across runtimes.
Technical questions
What happens if a digit exceeds its place bound?
The tool returns invalid_input. For example digit 3 at place 2! is illegal because d_2 must be at most 2.
Are negative numbers supported?
No. Factoradic encodes non-negative integers only; a leading minus is rejected with invalid_input.