# 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 subsequence.

# Details # Examples

open allclose all

## Basic Examples(3)

All possible subsequences:

All possible subsequences containing up to 2 elements:

Subsequences containing exactly 2 elements:

All subsequences of a biomolecular sequence containing exactly three elements:

## Scope(6)

All subsequences of {a,b,c,d}:

The first 2 subsequences containing 3 elements:

All subsequences with even length:

The 181 subsequence:

The odd-numbered subsequences of {a,b,c,d} in reverse order:

Use Subsequences with UpTo:

## Applications(2)

Use Subsequences to obtain all subsequences common to two lists:

Or specify the length of the common subsequences to consider:

Compare to LongestCommonSubsequence:

Construct the boundary of a hexagon and color its sides randomly:

## Properties & Relations(5)

Subsequences is equivalent to a form of Partition:

Subsequences preserves the order of the input:

Different occurrences of the same element are treated as distinct:

SequenceCases can also find the subsequences of a list:

Construct a 3x3 Hilbert matrix:

## Possible Issues(2)

Subsequences[list,nspec,spec] only evaluates when all requested items are present: Subsequences generates only one list of length 0:

This follows the behavior of Subsets: