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
Parameters
Description
Thread Safety
Examples
Compatibility
nextcomb( s, n )
prevcomb( s, n )
firstcomb( n, k )
lastcomb( n, k )
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
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.
For more information on thread safety, see index/threadsafe.
with⁡combinat
Chi,bell,binomial,cartprod,character,choose,composition,conjpart,decodepart,encodepart,eulerian1,eulerian2,fibonacci,firstcomb,firstpart,firstperm,graycode,inttovec,lastcomb,lastpart,lastperm,multinomial,nextcomb,nextpart,nextperm,numbcomb,numbcomp,numbpart,numbperm,partition,permute,powerset,prevcomb,prevpart,prevperm,randcomb,randpart,randperm,rankcomb,rankperm,setpartition,stirling1,stirling2,subsets,unrankcomb,unrankperm,vectoint
nextcomb⁡1,2,3,5
1,2,4
nextcomb⁡1,2,3,4,4
FAIL
prevcomb⁡2,3,4,5
1,4,5
prevcomb⁡1,2,3,4,5,5
firstcomb⁡5,3
1,2,3
lastcomb⁡5,3
3,4,5
The combinat[nextcomb], combinat[prevcomb], combinat[firstcomb] and combinat[lastcomb] commands were introduced in Maple 16.
For more information on Maple 16 changes, see Updates in Maple 16.
See Also
combinat[choose]
Download Help Document