HomeCalculatorsCombination Rank and Unrank

Combination Rank and Unrank

Map a lexicographically ordered combination to an exact rank and back.

Processing stays in your browser. Zero-based lexicographic rank; distinct sorted indexes from 0 to n−1. Uses exact BigInt arithmetic, n ≤ 200 and k ≤ 20.

How to use the combination rank and unrank

Review the labeled settings and example for combination rank and unrank. Paste your own input or use the optional UTF-8 upload where shown. Choose Calculate, inspect the output and any visual preview, then copy or download the result. Changing input clears the previous result.

Example

The first combination [0,1,2] has rank 0.

Good to know

Zero-based lexicographic rank; distinct sorted indexes from 0 to n−1. Uses exact BigInt arithmetic, n ≤ 200 and k ≤ 20.

Check definitions, units and boundary cases

Write the problem in the notation requested by the tool. Check angle units, matrix dimensions, coordinate conventions and whether a value must be an integer. Use a small case with a known answer before entering a larger expression or dataset. A numerical approximation and an exact symbolic result have different meanings, so read the method before interpreting displayed precision.

Inputs and settings explained

Pool size n
Enter a numeric value for pool size n, using the units and bounds indicated by the label and method notes. The demonstration uses 10. Check signs and scale before calculating; a percentage, fraction and whole-number count have different meanings.
See the demonstration value
10
Choose k
Enter a numeric value for choose k, using the units and bounds indicated by the label and method notes. The demonstration uses 3. Check signs and scale before calculating; a percentage, fraction and whole-number count have different meanings.
See the demonstration value
3
Mode
Choose the mode setting that matches your task. Available choices: Rank; Unrank. The supplied example selects Rank. Compare the result after changing this setting; the options describe different operations or conventions.
Zero-based combination indexes or rank
Enter the zero-based combination indexes or rank exactly as required by the example. Check spelling, whitespace and any stated naming rules before running the operation. Use a small test value first; an accepted text field does not by itself establish that the value is appropriate for the system that will consume the result.
See the demonstration value
0,1,2

How to review the result

Substitute the result into the original problem when possible. For a matrix operation, verify dimensions; for a root, inspect the residual; for a conversion, check the reverse operation where supported. Watch for division by zero, invalid domains and values too large for the chosen representation. A solver can accurately solve the supplied model while the model itself leaves out a condition that matters to your real task.

  • Confirm signs, units, input order and supported numerical ranges.
  • Compare with a small known example and inspect any residual or convergence information.
  • Keep the original expression and method with the result so it can be reproduced.

Common questions about this workflow

Do more decimal places mean a more accurate answer?

Displayed digits are limited by the numerical method and input precision. Rounding, floating-point representation and ill-conditioned problems can affect results. Use the stated method and a residual or independent check when precision matters.

What should I do if the solver rejects my input?

Check the mathematical domain and explicit size limits first. Reduce the problem to a known case and restore one feature at a time. Do not change a mathematical condition just to force the tool to return a number.

Built by DevBricks Technologies. Found an unexpected result in Combination Rank and Unrank? Report a reproducible example with the tool URL, settings and a small sample that contains no private information.