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.

Repeated-symbol arrangements

Count and locate multiset permutations

Choose the symbol order, compare exact prefix blocks and find the arrangement at any one-based position.

Distinct arrangements
60
6 positions · 3 symbol types
Edit symbol order and quantities

The first row comes first when comparing arrangements. Symbols are case-sensitive and start with a letter.

Symbol row 1
Symbol row 2
Symbol row 3

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
SymbolCopies leftFull ranksArrangements
A213–186
B119–213
N122–243
Arrangement lookup mode

Enter a complete arrangement, including the prefix.

Exact arrangement and rank

A B A N A B

Position within prefix
5
Full arrangement rank
17
Show how the rank narrows
PositionSymbolFull ranksArrangements
1A1–3030
2B13–2412
3A13–186
4N17–182
5A171
6B171
Download permutation CSV
Show selectable CSV

How to use this calculator

  1. Add the symbols and their quantities. Arrange the rows in the order used for comparing symbols.
  2. Type a prefix or choose one of the next-symbol blocks. A blank prefix starts from the full catalog of arrangements.
  3. Choose Find position and enter a complete arrangement separated by spaces or commas.
  4. Choose Find arrangement and enter a one-based position within the selected prefix.
  5. 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