 firstcomb - Maple Help

combinat

 nextcomb
 construct the lexicographic successor of a given combination
 prevcomb
 construct the lexicographic predecessor of a given combination
 firstcomb
 construct the lexicographically first combination
 lastcomb
 construct the lexicographically last combination Calling Sequence nextcomb( s, n ) prevcomb( s, n ) firstcomb( n, k ) lastcomb( n, k ) Parameters

 s - set(posint); a set of positive integers from 1 to n for some n n - nonnegint; size of the set from which combination members are chosen k - nonnegint; size of the combination Description

 • Given a combination p (of type set(posint)) of k integers chosen from {1,2, ..., n }, for some n, the command nextcomb returns the lexicographic successor of s.
 If s is the lexicographically last combination (that is, { n - k + 1, n - k + 2, ..., n}), then the value FAIL is returned.
 • Given a combination s (of type set(posint)) of k  integers chosen from {1,2, ..., n }, for some n, the command prevcomb returns the lexicographic predecessor of s.
 If s is the lexicographically first combination (that is, {1,2, ..., k}), then the value FAIL is returned.
 • The firstcomb command returns the lexicographically first combination of k elements chosen from {1, 2, ..., n }. This is the subset {1,2, ..., k}.
 • The lastcomb command returns the lexicographically last combination of k elements chosen from {1,2, ..., n }, which is { n - k + 1, n - k + 2, ..., n }. • The combinat[nextcomb], combinat[prevcomb], combinat[firstcomb] and combinat[lastcomb] commands are thread-safe as of Maple 16. Examples

 > $\mathrm{with}\left(\mathrm{combinat}\right)$
 $\left[{\mathrm{Chi}}{,}{\mathrm{bell}}{,}{\mathrm{binomial}}{,}{\mathrm{cartprod}}{,}{\mathrm{character}}{,}{\mathrm{choose}}{,}{\mathrm{composition}}{,}{\mathrm{conjpart}}{,}{\mathrm{decodepart}}{,}{\mathrm{encodepart}}{,}{\mathrm{eulerian1}}{,}{\mathrm{eulerian2}}{,}{\mathrm{fibonacci}}{,}{\mathrm{firstcomb}}{,}{\mathrm{firstpart}}{,}{\mathrm{firstperm}}{,}{\mathrm{graycode}}{,}{\mathrm{inttovec}}{,}{\mathrm{lastcomb}}{,}{\mathrm{lastpart}}{,}{\mathrm{lastperm}}{,}{\mathrm{multinomial}}{,}{\mathrm{nextcomb}}{,}{\mathrm{nextpart}}{,}{\mathrm{nextperm}}{,}{\mathrm{numbcomb}}{,}{\mathrm{numbcomp}}{,}{\mathrm{numbpart}}{,}{\mathrm{numbperm}}{,}{\mathrm{partition}}{,}{\mathrm{permute}}{,}{\mathrm{powerset}}{,}{\mathrm{prevcomb}}{,}{\mathrm{prevpart}}{,}{\mathrm{prevperm}}{,}{\mathrm{randcomb}}{,}{\mathrm{randpart}}{,}{\mathrm{randperm}}{,}{\mathrm{rankcomb}}{,}{\mathrm{rankperm}}{,}{\mathrm{setpartition}}{,}{\mathrm{stirling1}}{,}{\mathrm{stirling2}}{,}{\mathrm{subsets}}{,}{\mathrm{unrankcomb}}{,}{\mathrm{unrankperm}}{,}{\mathrm{vectoint}}\right]$ (1)
 > $\mathrm{nextcomb}\left(\left\{1,2,3\right\},5\right)$
 $\left\{{1}{,}{2}{,}{4}\right\}$ (2)
 > $\mathrm{nextcomb}\left(\left\{1,2,3,4\right\},4\right)$
 ${\mathrm{FAIL}}$ (3)
 > $\mathrm{prevcomb}\left(\left\{2,3,4\right\},5\right)$
 $\left\{{1}{,}{4}{,}{5}\right\}$ (4)
 > $\mathrm{prevcomb}\left(\left\{1,2,3,4,5\right\},5\right)$
 ${\mathrm{FAIL}}$ (5)
 > $\mathrm{firstcomb}\left(5,3\right)$
 $\left\{{1}{,}{2}{,}{3}\right\}$ (6)
 > $\mathrm{lastcomb}\left(5,3\right)$
 $\left\{{3}{,}{4}{,}{5}\right\}$ (7) Compatibility

 • The combinat[nextcomb], combinat[prevcomb], combinat[firstcomb] and combinat[lastcomb] commands were introduced in Maple 16.