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`
SelectPermutations
​
SelectPermutations
[list,crit]
generates a
list
of all possible permutations of the elements in
list
satisfying
crit
.
​
​
SelectPermutations
[list,n,crit]
gives all permutations containing at most
n
elements satisfying
crit
.
​
​
SelectPermutations
[list,{n},crit]
gives all permutations containing exactly
n
elements satisfying
crit
.
​
​
SelectPermutations
[…,crit,m]
gives at most
m
results.
​
Details and Options

Examples  
(8)
Basic Examples  
(2)
Select from the list {5,6,7,8,9} those permutations that form a prime when concatenating the digits:
In[1]:=
SelectPermutations
[{5,6,7,8,9},PrimeQ@*FromDigits]
Out[1]=
{{5,6,8,9,7},{5,7,6,8,9},{5,8,6,7,9},{5,8,9,6,7},{6,5,7,8,9},{6,7,5,8,9},{6,8,5,9,7},{6,9,8,5,7},{7,5,6,8,9},{7,5,8,6,9},{7,8,5,6,9},{8,6,5,7,9},{8,9,5,6,7},{8,9,6,5,7},{9,6,5,8,7},{9,6,8,5,7}}
Select permutations of length 3:
In[2]:=
SelectPermutations
[{5,6,7,8,9},{3},PrimeQ@*FromDigits]
Out[2]=
{{5,6,9},{5,8,7},{6,5,9},{7,6,9},{8,5,7},{8,5,9},{9,6,7}}
Select permutations with length 3—4:
In[3]:=
SelectPermutations
[{5,6,7,8,9},{3,4},PrimeQ@*FromDigits]
Out[3]=
{{5,6,9},{5,8,7},{6,5,9},{7,6,9},{8,5,7},{8,5,9},{9,6,7},{5,6,8,9},{5,8,6,7},{5,8,6,9},{5,8,7,9},{5,8,9,7},{5,9,8,7},{6,8,5,7},{7,5,8,9},{8,5,9,7},{9,5,8,7},{9,8,5,7}}
​
Select permutations for which the first two elements and the last elements add up to the same value:
In[1]:=
SelectPermutations
[{1,2,3,4},Total[#〚1;;2〛]Total[#〚3;;4〛]&]
Out[1]=
{{1,4,2,3},{1,4,3,2},{2,3,1,4},{2,3,4,1},{3,2,1,4},{3,2,4,1},{4,1,2,3},{4,1,3,2}}
Scope  
(1)

Applications  
(1)

Properties & Relations  
(3)

Possible Issues  
(1)

SeeAlso
Permutations
 
▪
Tuples
 
▪
Subsets
 
▪
Signature
 
▪
Select
 
▪
SelectTuples
 
▪
SelectSubsets
RelatedGuides
▪
Combinatorics
▪
Functions I understand in combinatorics
RelatedLinks
SelectPermutations
""

© 2025 Wolfram. All rights reserved.

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