Next: printfactors()
Up: Mathematical Macros Help File
Previous: orthopoly()
Contents
Usage:
Keywords:
integers
Usage:
partitions(n), where n > 0 is an integer, computes a matrix with n rows
whose columns are the partitions of n (padded with 0).
partitions(n,all:T) returns a structure R with n components, such
that R[j] is a matrix with j rows whose columns are the partitions
of j (padded with 0).
NOTE: A partition of an integer N is a set of positive integers
{n1,n2,...} such that n1 + n2 + ... = N.
Examples:
Cmd> partitions(4) # all 5 partitions of 4; rows add to 4
(1,1) 4 0 0 0
(2,1) 3 1 0 0
(3,1) 2 2 0 0
(4,1) 2 1 1 0
(5,1) 1 1 1 1
Cmd> partitions(3,all:T) # partitions of 1, 2 and 3
component: Parts_of_1
(1,1) 1
component: Parts_of_2
(1,1) 2 0
(2,1) 1 1
component: Parts_of_3
(1,1) 3 0 0
(2,1) 2 1 0
(3,1) 1 1 1
Gary Oehlert
2003-01-15