Wolfram Language
Paclet Repository
Community-contributed installable additions to the Wolfram Language
Primary Navigation
Categories
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
Create a Paclet
Get Started
Download Definition Notebook
Learn More about
Wolfram Language
Combinatorics
Tutorials
Combinatorics
Guides
Combinatorics
Functions I understand in combinatorics
Tech Notes
Combinatorics
Stirling permutation
Symbols
CanonicalMultiset
CentralBinomialCoefficient
ConjugatePartition
DescendingSublists
DivisorHasseDiagram
DominatingIntegerPartitionQ
DurfeeSquare
EnumerateMultisetPartialDerangements
EulerianCatalanNumber
EulerianNumber
EulerianNumberOfTheSecondKind
FerrersDiagram
Fibbinary
FibonacciEncode
FindAscentElements
FindAscentPositions
FindDescentElements
FindDescentPositions
FrobeniusSymbolFromPartition
FromInversionVector
FromPartitionPlusNotation
FromPartitionSuperscriptNotation
GaussFactorial
GrayCode
HasseDiagram
HookLengths
HuffmanCodeWords
HuffmanDecode
HuffmanEncode
IntegerPartitionQ
InverseFibonacci
InverseGrayCode
InversionCount
InversionVectorQ
LehmerCodeFromPermutation
LucasNumberU1
LucasNumberV2
ModifiedCentralBinomialCoefficient
Multichoose
MultisetAssociation
MultisetPartialDerangements
NarayanaNumber
NextPermutation
NumberOfTableaux
OrderedTupleFromIndex
OrderedTupleIndex
OrderlessCombinations
OrderlessCombinationsOfUnmarkedElements
PartialOrderGraphQ
PartitionCrank
PartitionFromFrobeniusSymbol
PartitionPlusNotation
PartitionRank
PartitionSuperscriptNotation
PermutationCountByInversions
PermutationFromIndex
PermutationGraph
PermutationIndex
PermutationMajorIndex
PermutationToTableaux
Phitorial
PosetQ
PosetToTableau
Primorial
QExponential
QMultinomial
RandomYoungTableau
RationalNumberRepeatingDecimalPeriod
ReflexiveGraphQ
SecantNumber
SelectPermutations
SelectSubsets
SelectTuples
SelfConjugatePartitionQ
SignedLahNumber
StandardYoungTableaux
StirlingPermutationGraph
StirlingPermutations
StrictIntegerPartitions
SubsetFromIndex
SubsetIndex
TableauQ
TableauToPoset
TableauxToPermutation
TangentNumber
ToInversionVector
TransitiveGraphQ
TransposeTableau
TupleFromIndex
TupleIndex
UnsignedLahNumber
YoungDiagram
ZeckendorfRepresentation
Combinatorics
Some of the functions here do not belong in combinatorics. I am including them here anyways.
Indexing
P
e
r
m
u
t
a
t
i
o
n
I
n
d
e
x
— Give the lexicographic index of a permutation
P
e
r
m
u
t
a
t
i
o
n
F
r
o
m
I
n
d
e
x
— Give the permutation corresponding to a given length and lexicographic index
S
u
b
s
e
t
I
n
d
e
x
— Give the index of a subset
S
u
b
s
e
t
F
r
o
m
I
n
d
e
x
— Get the subset with the given index and length
T
u
p
l
e
I
n
d
e
x
— Compute the index of a given tuple of non-negative integers
T
u
p
l
e
F
r
o
m
I
n
d
e
x
— Return the tuple corresponding to a given index
O
r
d
e
r
e
d
T
u
p
l
e
I
n
d
e
x
— Give the index of an ordered tuple
O
r
d
e
r
e
d
T
u
p
l
e
F
r
o
m
I
n
d
e
x
— Get the ordered tuple with the given index and length
L
e
h
m
e
r
C
o
d
e
F
r
o
m
P
e
r
m
u
t
a
t
i
o
n
— Create the Lehmer code corresponding to a given permutation
Partitions
C
o
n
j
u
g
a
t
e
P
a
r
t
i
t
i
o
n
— Switch the rows and columns of a partition
D
o
m
i
n
a
t
i
n
g
I
n
t
e
g
e
r
P
a
r
t
i
t
i
o
n
Q
— Determine if one integer partition dominates another
I
n
t
e
g
e
r
P
a
r
t
i
t
i
o
n
Q
— Check whether the argument is a weakly decreasing list of positive integers
P
a
r
t
i
t
i
o
n
C
r
a
n
k
— Get Dyson's crank of an integer partition
P
a
r
t
i
t
i
o
n
F
r
o
m
F
r
o
b
e
n
i
u
s
S
y
m
b
o
l
— Construct the corresponding partition, given a Frobenius symbol
P
a
r
t
i
t
i
o
n
R
a
n
k
— The largest part minus the number of parts of a partition
F
r
o
b
e
n
i
u
s
S
y
m
b
o
l
F
r
o
m
P
a
r
t
i
t
i
o
n
— Get a pair of lists representing the Ferrers diagram of a partition
F
e
r
r
e
r
s
D
i
a
g
r
a
m
— Display the Ferrers diagram of a partition with dots
D
u
r
f
e
e
S
q
u
a
r
e
— get the dimensions of the Durfee square of a partition
S
e
l
f
C
o
n
j
u
g
a
t
e
P
a
r
t
i
t
i
o
n
Q
— test if a partition is a self-conjugate partition
Tableaux
T
a
b
l
e
a
u
Q
— Determine if a list of values forms a Young tableau
T
r
a
n
s
p
o
s
e
T
a
b
l
e
a
u
— Transpose a Young tableau
P
e
r
m
u
t
a
t
i
o
n
T
o
T
a
b
l
e
a
u
x
— Get the two Young tableaux corresponding to a permutation
T
a
b
l
e
a
u
x
T
o
P
e
r
m
u
t
a
t
i
o
n
— Get a permutation corresponding to two Young tableaux
T
a
b
l
e
a
u
T
o
P
o
s
e
t
— Convert a Young tableau to a partially ordered set of coordinates
N
u
m
b
e
r
O
f
T
a
b
l
e
a
u
x
— Get a count of Young tableaux for a given size or shape
H
o
o
k
L
e
n
g
t
h
s
— Get the list of lists whose entries are the hook lengths of the entries of a Young tableau
S
t
a
n
d
a
r
d
Y
o
u
n
g
T
a
b
l
e
a
u
x
— Enumerate all standard Young tableaux of a given shape
R
a
n
d
o
m
Y
o
u
n
g
T
a
b
l
e
a
u
— Generate a random Young tableau with a given shape
Multisets
C
a
n
o
n
i
c
a
l
M
u
l
t
i
s
e
t
— canonical form of a multiset
E
n
u
m
e
r
a
t
e
M
u
l
t
i
s
e
t
P
a
r
t
i
a
l
D
e
r
a
n
g
e
m
e
n
t
s
— enumerate a multiset's partial derangements
M
u
l
t
i
c
h
o
o
s
e
— compute the multichoose operation
M
u
l
t
i
s
e
t
A
s
s
o
c
i
a
t
i
o
n
— assign every element of a multiset a unique number, in effect turning a multiset into a set.
M
u
l
t
i
s
e
t
P
a
r
t
i
a
l
D
e
r
a
n
g
e
m
e
n
t
s
— list the partial derangements of a multiset one by one
Make a list of the elements one by one
O
r
d
e
r
l
e
s
s
C
o
m
b
i
n
a
t
i
o
n
s
— Generate all possible orderless lists of a given length with a given set of elements
O
r
d
e
r
l
e
s
s
C
o
m
b
i
n
a
t
i
o
n
s
O
f
U
n
m
a
r
k
e
d
E
l
e
m
e
n
t
s
— Generate all possible orderless lists of a given length with a given set of unmarked indistinguishable plain unlabeled elements
Combinatorial Optimization and Existence
S
e
l
e
c
t
P
e
r
m
u
t
a
t
i
o
n
s
— Get permutations that satisfy a certain criterion
S
e
l
e
c
t
S
u
b
s
e
t
s
— Generate subsets that satisfy a certain criterion
S
e
l
e
c
t
T
u
p
l
e
s
— Generate tuples that satisfy a certain criterion
Combinatorial Functions
C
e
n
t
r
a
l
B
i
n
o
m
i
a
l
C
o
e
f
f
i
c
i
e
n
t
— compute the central binomial coefficient
E
u
l
e
r
i
a
n
C
a
t
a
l
a
n
N
u
m
b
e
r
— compute the Eulerian Catalan number
E
u
l
e
r
i
a
n
N
u
m
b
e
r
— Get the number of permutations with a given number of ascents
E
u
l
e
r
i
a
n
N
u
m
b
e
r
O
f
T
h
e
S
e
c
o
n
d
K
i
n
d
— compute the Eulerian number of the second kind
N
a
r
a
y
a
n
a
N
u
m
b
e
r
— compute the Narayana number
S
e
c
a
n
t
N
u
m
b
e
r
— compute the secant number
S
k
, also referred to a zig number
S
i
g
n
e
d
L
a
h
N
u
m
b
e
r
— compute the signed Lah number
L
(
n
,
k
)
T
a
n
g
e
n
t
N
u
m
b
e
r
— compute the tangent numbers, also referred to as zag numbers
U
n
s
i
g
n
e
d
L
a
h
N
u
m
b
e
r
— compute the unsigned Lah number
L
(
n
,
k
)
Encoding, Decoding, and Representation related
F
i
b
b
i
n
a
r
y
— Get the fibbinary sequence
F
i
b
o
n
a
c
c
i
E
n
c
o
d
e
— Fibonacci-digit encoding for a number
G
r
a
y
C
o
d
e
— Find the Gray code for an integer
H
u
f
f
m
a
n
C
o
d
e
W
o
r
d
s
— Find optimal Huffman code words given a list of probabilities
H
u
f
f
m
a
n
D
e
c
o
d
e
— Decode data specified by a Huffman encoding
H
u
f
f
m
a
n
E
n
c
o
d
e
— Find a Huffman encoding for a string
I
n
v
e
r
s
e
F
i
b
o
n
a
c
c
i
— Compute the inverse Fibonacci function
I
n
v
e
r
s
e
G
r
a
y
C
o
d
e
— Find the integer corresponding to a given Gray code
Z
e
c
k
e
n
d
o
r
f
R
e
p
r
e
s
e
n
t
a
t
i
o
n
— Give the 0–1 list that indicates the unique nonconsecutive Fibonacci numbers that sum to the non-negative integer input
Permutation Functions
L
e
h
m
e
r
C
o
d
e
F
r
o
m
P
e
r
m
u
t
a
t
i
o
n
— Create the Lehmer code corresponding to a given permutation
N
e
x
t
P
e
r
m
u
t
a
t
i
o
n
— Get the next permutation in lexicographic order
P
e
r
m
u
t
a
t
i
o
n
A
s
c
e
n
t
s
— Give the indices of a permutation where there is an immediate ascent
P
e
r
m
u
t
a
t
i
o
n
G
r
a
p
h
— Compute the permutation graph of a permutation
P
e
r
m
u
t
a
t
i
o
n
I
n
d
e
x
— Give the lexicographic index of a permutation
P
e
r
m
u
t
a
t
i
o
n
F
r
o
m
I
n
d
e
x
— Give the permutation corresponding to a given length and lexicographic index
P
e
r
m
u
t
a
t
i
o
n
M
a
j
o
r
I
n
d
e
x
— Compute the major index of a permutation
P
e
r
m
u
t
a
t
i
o
n
T
o
T
a
b
l
e
a
u
x
— Get the two Young tableaux corresponding to a permutation
T
a
b
l
e
a
u
x
T
o
P
e
r
m
u
t
a
t
i
o
n
— Get a permutation corresponding to two Young tableaux
Permutation Inversion functions
F
r
o
m
I
n
v
e
r
s
i
o
n
V
e
c
t
o
r
— Construct the permutation list corresponding to the given inversion vector
I
n
v
e
r
s
i
o
n
C
o
u
n
t
— Count the number of pairs of out-of-order elements in a permutation
I
n
v
e
r
s
i
o
n
V
e
c
t
o
r
Q
— Check if a list is the inversion vector of a permutation written as a list
P
e
r
m
u
t
a
t
i
o
n
C
o
u
n
t
B
y
I
n
v
e
r
s
i
o
n
s
— Get the number of permutations having a specified length and number of inversions
Permutation Runs and Ascents
D
e
s
c
e
n
d
i
n
g
S
u
b
l
i
s
t
s
— Split a list at its left-to-right maxima
P
e
r
m
u
t
a
t
i
o
n
A
s
c
e
n
t
s
— Give the indices of a permutation where there is an immediate ascent
E
u
l
e
r
i
a
n
N
u
m
b
e
r
— Get the number of permutations with a given number of ascents
E
u
l
e
r
i
a
n
N
u
m
b
e
r
O
f
T
h
e
S
e
c
o
n
d
K
i
n
d
— compute the Eulerian number of the second kind
Order Theory
D
i
v
i
s
o
r
H
a
s
s
e
D
i
a
g
r
a
m
— Generate a transitive reduction graph for the divisors of a positive integer
H
a
s
s
e
D
i
a
g
r
a
m
— Construct a Hasse diagram of a poset
P
a
r
t
i
a
l
O
r
d
e
r
G
r
a
p
h
Q
— Test whether a graph is a partial order, that is, reflexive, antisymmetric and transitive
P
o
s
e
t
Q
— Determine if a set of coordinates is partially ordered
T
a
b
l
e
a
u
T
o
P
o
s
e
t
— Convert a Young tableau to a partially ordered set of coordinates
R
e
f
l
e
x
i
v
e
G
r
a
p
h
Q
— Test whether a graph is reflexive
T
r
a
n
s
i
t
i
v
e
G
r
a
p
h
Q
— Test whether the binary relation defined by edges of a graph is transitive
Factorial Functions
G
a
u
s
s
F
a
c
t
o
r
i
a
l
— compute the Gauss factorial
P
h
i
t
o
r
i
a
l
— compute the phitorial
P
r
i
m
o
r
i
a
l
— compute the primorial
Recurrence Functions
L
u
c
a
s
N
u
m
b
e
r
U
1
— compute the term of the Lucas sequence of the first kind
L
u
c
a
s
N
u
m
b
e
r
V
2
— compute the term of the Lucas sequence of the second kind
Q Analogues
Q
E
x
p
o
n
e
n
t
i
a
l
— q-exponential
Q
M
u
l
t
i
n
o
m
i
a
l
— q-multinomial
Modular Number Theory
R
a
t
i
o
n
a
l
N
u
m
b
e
r
R
e
p
e
a
t
i
n
g
D
e
c
i
m
a
l
P
e
r
i
o
d
— find the period of a repeating decimal of a rational number
Alternating Permutations
S
e
c
a
n
t
N
u
m
b
e
r
— compute the secant number
S
k
, also referred to a zig number
T
a
n
g
e
n
t
N
u
m
b
e
r
— compute the tangent numbers, also referred to as zag numbers
"
"