Calculator
Example data table
| Symbols | Total unique permutations | Requested position | Nth permutation | Example rank | Previous | Next |
|---|---|---|---|---|---|---|
| A, A, B, C | 12 | 5 | ACAB | 3 for ABAC | AACB | ABCA |
| 1, 1, 2, 3 | 12 | 8 | 2131 | 1 for 1123 | None before 1123 | 1132 after 1123 |
| X, Y, Z | 6 | 4 | YZX | 2 for XZY | XYZ | YXZ |
Formula used
Total unique permutations for repeated symbols
Total = n! / (c₁! × c₂! × ... × cₖ!), where n is total symbols and each cᵢ is the frequency of one repeated symbol.
Nth lexicographic permutation
At each position, test each possible symbol in sorted order. The block size after fixing one symbol equals the remaining multiset permutation count. Skip full blocks until the requested rank falls inside one block.
Rank of a given permutation
Start rank at 1. At each position, add the counts of every lexicographically smaller valid symbol that could appear there, then continue with the actual symbol.
How to use this calculator
- Enter your symbol set. Use commas for multi-word items.
- Select the order direction and analysis mode.
- Enter a requested position, a target permutation, or both.
- Submit the form to see totals, rank, neighbors, and step tables.
- Review the Plotly graph for completion sizes at each position.
- Download the current result as CSV or PDF when needed.
Frequently asked questions
1. What is a lexicographic permutation?
It is an ordering of permutations based on sorted comparison, much like dictionary order. Smaller leading symbols appear earlier. The calculator supports both ascending and descending order rules.
2. Does this calculator handle repeated symbols?
Yes. It counts only unique arrangements when duplicates exist. The total uses the multinomial formula, so repeated symbols do not create duplicate results.
3. What happens if I enter words instead of characters?
Use commas between items such as red, blue, blue, green. The calculator then treats each trimmed item as one symbol and permutes them lexicographically.
4. Why is the graph shown on a log scale?
Permutation counts grow very quickly. A log10 scale keeps large completion counts readable, so later positions remain visible without flattening smaller values.
5. How is the nth permutation found efficiently?
The calculator skips whole lexicographic blocks instead of listing every permutation. Each block size comes from remaining multiset counts after fixing one symbol.
6. Can I find the rank of a specific arrangement?
Yes. Enter the original symbol set and your target permutation. The calculator adds all skipped valid blocks and returns the exact one-based rank.
7. What are next and previous permutations?
They are the immediate neighboring unique arrangements in the selected lexicographic order. If your target is already first or last, one neighbor will not exist.
8. Why might an input be rejected?
Common issues include an invalid rank, mismatched target symbols, or too many items for responsive exact analysis. The calculator explains the specific problem above the form.