composition - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


combinat

  

composition

  

k-compositions of an integer

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

composition(n, k)

Parameters

n, k

-

non-negative integers

Description

• 

The procedure composition computes and returns a list containing all distinct ordered k-tuples of positive integers whose elements sum to n.  These are known as the compositions of n.

• 

In the list of k-tuples returned, each k-tuple is a list representing a particular composition of n.

• 

See also the function numbcomp, which computes the number of different compositions of an integer.

• 

The command with(combinat,composition) allows the use of the abbreviated form of this command.

Examples

withcombinat:

composition5,2

1,4,2,3,3,2,4,1

(1)

composition3,3

1,1,1

(2)

composition4,3

1,1,2,1,2,1,2,1,1

(3)

See Also

@

combinat

combinat[numbcomp]