LLexiNest
Product

Product features · Lexicographic permutation unranking

01

Place rank fixtures next to ordering-sensitive callers and inspect which remaining item each factorial-sized block selects, keeping the external indexing convention explicit.

01

Connection

Base URL, credentials and a reachable server.

02

Selection

A model available through the configured endpoint.

03

Capabilities

Context limits and tool support are determined by the model and server.

Lexicographic permutation unranking

● ● ●LexiNest●
A concrete starting point · Lexicographic permutation unranking ×
from math import factorial
def unrank_permutation(size, rank):
    if type(size) is not int or not 0 <= size <= 10:
        raise ValueError("size 0 through 10")
    if type(rank) is not int or not 0 <= rank < factorial(size):
        raise ValueError("rank outside permutation count")
    available, result = list(range(size)), []
    for remaining in range(size,0,-1):
        index, rank = divmod(rank, factorial(remaining-1))
        result.append(available.pop(index))
    return result
✳Recover the lexicographic permutation of size zero through ten at an integer rank.
✓ ChangesReview before applying ↗
Illustrative workspace
AI coding workspace

Your next change starts here.

Get the Windows app ↗