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`
PermutationCountByInversions
​
PermutationCountByInversions
[n,k]
gives the number of permutations of length
n
with exactly
k
inversions.
​
​
PermutationCountByInversions
[n]
gives a
List
for all
k
starting at zero.
​
Details and Options

Examples  
(7)
Basic Examples  
(2)
The number of permutations of length 7 with 16 inversions:
In[1]:=
PermutationCountByInversions
[7,16]
Out[1]=
169
​
The
List
of 7-permutations for all possible
k
:
In[1]:=
PermutationCountByInversions
[7]
Out[1]=
{1,6,20,49,98,169,259,359,455,531,573,573,531,455,359,259,169,98,49,20,6,1}
Scope  
(1)

Properties & Relations  
(4)

SeeAlso
Permutations
 
▪
InversePermutation
 
▪
Subsets
 
▪
Tuples
 
▪
Signature
 
▪
ToInversionVector
 
▪
InversionCount
 
▪
PermutationMajorIndex
 
▪
PermutationIndex
 
▪
PermutationFromIndex
 
▪
NextPermutation
 
▪
FromInversionVector
 
▪
InversionVectorQ
RelatedGuides
▪
Combinatorics
RelatedLinks
▪
Tutorial: Combinatorica
PermutationCountByInversions
Resource Function contributed by Wolfram Staff (original content by Sriram V. Pemmaraju and Steven S. Skiena)
""

© 2025 Wolfram. All rights reserved.

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