Subsequences

Subsequences[list]

gives the list of all possible subsequences of list.

Subsequences[list,n]

gives all subsequences containing at most n elements.

Subsequences[list,{n}]

gives all subsequences containing exactly n elements.

Subsequences[list,{nmin,nmax}]

gives all subsequences containing between nmin and nmax elements.

Subsequences[list,nspec,s]

limits the result to the first s subsequences.

Subsequences[list,nspec,{s}]

gives if possible the s ^(th) subsequence.

Details

Examples

open allclose all

Basic Examples  (2)

All possible subsequences:

In[1]:=
Click for copyable input
Out[1]=

All possible subsequences containing up to 2 elements:

In[1]:=
Click for copyable input
Out[1]=

Subsequences containing exactly 2 elements:

In[2]:=
Click for copyable input
Out[2]=

Scope  (6)

Generalizations & Extensions  (1)

Applications  (2)

Properties & Relations  (5)

Possible Issues  (2)

See Also

Partition  Subsets  LongestCommonSubsequence  SequenceCases  BlankSequence

Introduced in 2016
(10.4)