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`
TupleFromIndex
​
TupleFromIndex
[index,k]
returns
index
from the list of
k
tuples sorted by maximal element.
​
Details and Options

Examples  
(8)
Basic Examples  
(5)
Create 2-tuples from their index:
In[1]:=
Table
TupleFromIndex
[n,2],{n,1,9}
Out[1]=
{{0,0},{0,1},{1,0},{1,1},{0,2},{1,2},{2,0},{2,1},{2,2}}
​
The first nine 2-tuples sorted by maximal element:
In[1]:=
SortBy[Tuples[{0,1,2},{2}],Max[#]&]
Out[1]=
{{0,0},{0,1},{1,0},{1,1},{0,2},{1,2},{2,0},{2,1},{2,2}}
​
Create 3-tuples from their index:
In[1]:=
Table
TupleFromIndex
[n,3],{n,1,27}
Out[1]=
{{0,0,0},{0,0,1},{0,1,0},{0,1,1},{1,0,0},{1,0,1},{1,1,0},{1,1,1},{0,0,2},{0,1,2},{0,2,0},{0,2,1},{0,2,2},{1,0,2},{1,1,2},{1,2,0},{1,2,1},{1,2,2},{2,0,0},{2,0,1},{2,0,2},{2,1,0},{2,1,1},{2,1,2},{2,2,0},{2,2,1},{2,2,2}}
​
The function can return tuples of a given index for various lengths:
In[1]:=
Table
TupleFromIndex
[2019,len],{len,2,9}
Out[1]=
{{44,38},{11,12,3},{5,6,1,2},{2,4,0,2,2},{1,2,3,2,3,3},{2,2,0,2,2,0,2},{0,2,1,2,1,0,0,0},{0,0,2,0,2,0,1,1,2}}
​
Find the trillionth
k
-tuple:
In[1]:=
Table
TupleFromIndex
[10^12,k],{k,2,12}
Out[1]=
{{999999,999999},{9999,9999,9999},{999,999,999,999},{58,251,174,151,123},{99,99,99,99,99,99},{47,11,16,51,29,21,41},{21,17,31,0,18,30,14,27},{12,1,14,3,17,21,14,15,8},{13,15,14,1,3,13,15,3,7,0},{3,5,5,0,8,9,9,12,8,4,0},{9,9,9,9,9,9,9,9,9,9,9,9}}
Properties & Relations  
(1)

Neat Examples  
(2)

SeeAlso
Subsets
 
▪
Tuples
 
▪
OrderedTupleIndex
 
▪
OrderedTupleFromIndex
 
▪
PermutationIndex
 
▪
PermutationFromIndex
 
▪
SubsetIndex
 
▪
SubsetFromIndex
 
▪
TupleIndex
RelatedGuides
▪
Combinatorics
RelatedLinks
TupleFromIndex
Resource Function created by Ed Pegg Jr.
""

© 2025 Wolfram. All rights reserved.

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