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

# 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:

Wolfram Research (2016), Subsequences, Wolfram Language function, https://reference.wolfram.com/language/ref/Subsequences.html (updated 2020).

#### Text

Wolfram Research (2016), Subsequences, Wolfram Language function, https://reference.wolfram.com/language/ref/Subsequences.html (updated 2020).

#### CMS

Wolfram Language. 2016. "Subsequences." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/Subsequences.html.

#### APA

Wolfram Language. (2016). Subsequences. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Subsequences.html

#### BibTeX

@misc{reference.wolfram_2023_subsequences, author="Wolfram Research", title="{Subsequences}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/Subsequences.html}", note=[Accessed: 24-September-2023 ]}

#### BibLaTeX

@online{reference.wolfram_2023_subsequences, organization={Wolfram Research}, title={Subsequences}, year={2020}, url={https://reference.wolfram.com/language/ref/Subsequences.html}, note=[Accessed: 24-September-2023 ]}