Multiset Permutation, Rank & Prefix Calculator
Create an ordered list of symbols with their quantities. Count the distinct arrangements, choose a prefix to inspect its exact rank block, and then find the position of an entered arrangement or recover the arrangement at a chosen position. Identical copies of a symbol are interchangeable.
Count and locate multiset permutations
Choose the symbol order, compare exact prefix blocks and find the arrangement at any one-based position.
Edit symbol order and quantities
The first row comes first when comparing arrangements. Symbols are case-sensitive and start with a letter.
Separate symbols with spaces or commas. An empty prefix includes every arrangement.
Next-symbol rank blocks
- Selected prefix
- A B
- Arrangements in this prefix
- 12
- Full ranks in this prefix
- 13–24
Each segment represents the share of this prefix that starts with the next symbol.
Show all next-symbol counts
| Symbol | Copies left | Full ranks | Arrangements |
|---|---|---|---|
| A | 2 | 13–18 | 6 |
| B | 1 | 19–21 | 3 |
| N | 1 | 22–24 | 3 |
Exact arrangement and rank
A B A N A B
- Position within prefix
- 5
- Full arrangement rank
- 17
Show how the rank narrows
| Position | Symbol | Full ranks | Arrangements |
|---|---|---|---|
| 1 | A | 1–30 | 30 |
| 2 | B | 13–24 | 12 |
| 3 | A | 13–18 | 6 |
| 4 | N | 17–18 | 2 |
| 5 | A | 17 | 1 |
| 6 | B | 17 | 1 |
Show selectable CSV
How to use this calculator
- Add the symbols and their quantities. Arrange the rows in the order used for comparing symbols.
- Type a prefix or choose one of the next-symbol blocks. A blank prefix starts from the full catalog of arrangements.
- Choose Find position and enter a complete arrangement separated by spaces or commas.
- Choose Find arrangement and enter a one-based position within the selected prefix.
- Review the global rank blocks and export the prefix and exact positions for reuse.
The Formula
The mathematical logic powering this calculation is:
For N total positions and entered symbol quantities c₁, c₂, …, cₖ, the number of distinct full arrangements is N!/(c₁!c₂!…cₖ!). Copies of each symbol are interchangeable. The symbol rows set the lexicographic order. For two arrangements, compare their first differing symbol in that row order.
Start with full ranks 1 through the total, inclusive. A valid prefix consumes the entered copies and identifies a contiguous block of full ranks. If C arrangements share a prefix and M positions remain, a next symbol with c copies left starts a sub-block with exactly Cc/M arrangements. Place these sub-blocks in the declared symbol order. Their counts add to C whenever positions remain. The branches are empty when the prefix already fills every position, and its block then contains exactly one arrangement.
Walk down the sub-blocks to rank an entered arrangement. At each step take the block for the next symbol. The final singleton gives its full rank. The position inside the selected prefix is full rank minus the first rank of that prefix plus 1.
To recover an arrangement, enter a one-based position within the selected prefix. Add that position minus 1 to the prefix’s first full rank. At each step take the unique sub-block containing that full rank until all positions are filled.
The calculator accepts 1 to 10 distinct case-sensitive symbols with 1 to 40 positions total. Counts, rank endpoints and positions use exact integer arithmetic. The bar allocates space by the proportion of remaining copies, which is also the proportion of arrangements in each next-symbol block.Worked Example
If you input:
- Symbols in order: A × 3, B × 2, N × 1
- Selected prefix: A B
- Mode: Find position
- Arrangement: A B A N A B
Result:
There are 60 distinct arrangements. The prefix A B contains 12 arrangements at full ranks 13 through 24. A B A N A B is position 5 in the prefix and full rank 17.
Frequently Asked Questions
Why are there fewer multiset permutations than N factorial?
Swapping identical copies leaves the arrangement unchanged. Dividing N factorial by the factorial of each repeated symbol’s quantity counts each distinct sequence once.
How does the declared symbol order affect the rank?
The first row is the earliest symbol. Changing the order can change each arrangement’s rank while keeping the total number of arrangements the same.
Is the ranking zero-based or one-based?
The first full arrangement is rank 1. The first arrangement in any selected prefix is also position 1 within that prefix.
Does selecting a prefix change an arrangement’s full rank?
The full rank still refers to the complete list. A prefix limits the choices and gives each eligible arrangement a position within that block.
What happens when the prefix already uses all positions?
It specifies one distinct arrangement, so its position within the prefix is 1 and there are no additional symbols to choose.
Similar Calculators
Permutation & Combination Calculator
Calculate nPr and nCr values for arranging or selecting items with or without order.
Binomial Probability Calculator
Find exact, cumulative, or upper-tail binomial probabilities for repeated yes/no events.
Spearman Rank Correlation Calculator & Permutation Test
Compare Spearman rank and Pearson correlations, see averaged ranks for ties, and run an exact or seeded permutation test on paired data.
