Wolfram Language Paclet Repository

Community-contributed installable additions to the Wolfram Language

Primary Navigation

    • Cloud & Deployment
    • Core Language & Structure
    • Data Manipulation & Analysis
    • Engineering Data & Computation
    • External Interfaces & Connections
    • Financial Data & Computation
    • Geographic Data & Computation
    • Geometry
    • Graphs & Networks
    • Higher Mathematical Computation
    • Images
    • Knowledge Representation & Natural Language
    • Machine Learning
    • Notebook Documents & Presentation
    • Scientific and Medical Data & Computation
    • Social, Cultural & Linguistic Data
    • Strings & Text
    • Symbolic & Numeric Computation
    • System Operation & Setup
    • Time-Related Computation
    • User Interface Construction
    • Visualization & Graphics
    • Random Paclet
    • Alphabetical List
  • Using Paclets
    • Get Started
    • Download Definition Notebook
  • Learn More about Wolfram Language

Combinatorics

Tutorials

  • Combinatorics
  • Combinatorics-1
  • Combinatorics-2

Guides

  • Combinatorics
  • Functions I understand in combinatorics

Tech Notes

  • Combinatorics

Symbols

  • CanonicalMultiset
  • CentralBinomialCoefficient
  • ConjugatePartition
  • DescendingSublists
  • DivisorHasseDiagram
  • DominatingIntegerPartitionQ
  • DurfeeSquare
  • EnumerateMultisetPartialDerangements
  • EulerianCatalanNumber
  • EulerianNumber
  • EulerianNumberOfTheSecondKind
  • FerrersDiagram
  • Fibbinary
  • FibonacciEncode
  • FindAscentElements
  • FindAscentPositions
  • FrobeniusSymbolFromPartition
  • FromInversionVector
  • FromPartitionPlusNotation
  • FromPartitionSuperscriptNotation
  • GaussFactorial
  • GrayCode
  • HasseDiagram
  • HookLengths
  • HuffmanCodeWords
  • HuffmanDecode
  • HuffmanEncode
  • IntegerPartitionQ
  • InverseFibonacci
  • InverseGrayCode
  • InversionCount
  • InversionVectorQ
  • LehmerCodeFromPermutation
  • LucasNumberU1
  • LucasNumberV2
  • ModifiedCentralBinomialCoefficient
  • Multichoose
  • MultisetAssociation
  • MultisetPartialDerangements
  • MultisetStrictDescentElements
  • MultisetStrictDescents
  • NarayanaNumber
  • NextPermutation
  • NumberOfTableaux
  • OrderedTupleFromIndex
  • OrderedTupleIndex
  • OrderlessCombinations
  • OrderlessCombinationsOfUnmarkedElements
  • PartialOrderGraphQ
  • PartitionCrank
  • PartitionFromFrobeniusSymbol
  • PartitionPlusNotation
  • PartitionRank
  • PartitionSuperscriptNotation
  • PermutationAscents
  • PermutationCountByInversions
  • PermutationDescents
  • PermutationFromIndex
  • PermutationGraph
  • PermutationIndex
  • PermutationMajorIndex
  • PermutationToTableaux
  • Phitorial
  • PosetQ
  • PosetToTableau
  • Primorial
  • QExponential
  • QMultinomial
  • RandomYoungTableau
  • RationalNumberRepeatingDecimalPeriod
  • ReflexiveGraphQ
  • SecantNumber
  • SelectPermutations
  • SelectSubsets
  • SelectTuples
  • SelfConjugatePartitionQ
  • SignedLahNumber
  • StandardYoungTableaux
  • StrictIntegerPartitions
  • SubsetFromIndex
  • SubsetIndex
  • TableauQ
  • TableauToPoset
  • TableauxToPermutation
  • TangentNumber
  • ToInversionVector
  • TransitiveGraphQ
  • TransposeTableau
  • TupleFromIndex
  • TupleIndex
  • UnsignedLahNumber
  • YoungDiagram
  • ZeckendorfRepresentation
PeterBurbery`Combinatorics`
PermutationFromIndex
​
PermutationFromIndex
[index,lengthInput]
returns the permutation of length
lengthInput
corresponding to the
index
th permutation in lexicographic order.
​
Examples  
(2)
Basic Examples  
(1)
Produce the first permutation of length 7:
In[1]:=
PermutationFromIndex
[1,7]
Out[1]=
{1,2,3,4,5,6,7}
Produce the last permutation of length 7:
In[2]:=
PermutationFromIndex
[-1,7]
Out[2]=
{7,6,5,4,3,1,2}
Produce permutations with an index of n!/2:
In[3]:=
GridTable
PermutationFromIndex
[n!/2,n],{n,2,19}
Out[3]=
1
2
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2
1
3
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2
4
3
1
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3
2
5
4
1
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3
6
5
4
2
1
​
​
​
​
​
​
​
​
​
​
​
​
​
4
3
7
6
5
2
1
​
​
​
​
​
​
​
​
​
​
​
​
4
8
7
6
5
3
2
1
​
​
​
​
​
​
​
​
​
​
​
5
4
9
8
7
6
3
2
1
​
​
​
​
​
​
​
​
​
​
5
10
9
8
7
6
4
3
2
1
​
​
​
​
​
​
​
​
​
6
5
11
10
9
8
7
4
3
2
1
​
​
​
​
​
​
​
​
6
12
11
10
9
8
7
5
4
3
2
1
​
​
​
​
​
​
​
7
6
13
12
11
10
9
8
5
4
3
2
1
​
​
​
​
​
​
7
14
13
12
11
10
9
8
6
5
4
3
2
1
​
​
​
​
​
8
7
15
14
13
12
11
10
9
6
5
4
3
2
1
​
​
​
​
8
16
15
14
13
12
11
10
9
7
6
5
4
3
2
1
​
​
​
9
8
17
16
15
14
13
12
11
10
7
6
5
4
3
2
1
​
​
9
18
17
16
15
14
13
12
11
10
8
7
6
5
4
3
2
1
​
10
9
19
18
17
16
15
14
13
12
11
8
7
6
5
4
3
2
1
Neat Examples  
(1)

SeeAlso
PermutationIndex
 
▪
LehmerCodeFromPermutation
 
▪
OrderedTupleIndex
 
▪
OrderedTupleFromIndex
 
▪
SubsetIndex
 
▪
SubsetFromIndex
 
▪
TupleFromIndex
 
▪
TupleIndex
 
▪
Tuples
 
▪
Subsets
 
▪
SortBy
RelatedGuides
▪
Combinatorics
▪
Functions I understand in combinatorics
RelatedLinks
PermutationFromIndex
Resource Function created by Ed Pegg Jr.
""

© 2025 Wolfram. All rights reserved.

  • Legal & Privacy Policy
  • Contact Us
  • WolframAlpha.com
  • WolframCloud.com