Mathematical Experiment 2

Find the coefficients in the exapnsion of the polynomials for .

> for i to 7 do expand(product((x+j),j=1..i)) od;

>

Compare the result just obtained with the Stirling numbers of the first kind.

Define a function := and then compute for .

Compare the result just obtained with the Stirling numbers of the second kind.

List all permutations of [1,2,3,4].

List all permutations of {a,b,c,d,e} taken two at a time.

Find the number of permutations of [1,2,..,100] taken three at a time.

> permute({a,b,c,d,e},2);

List all subsets of {1,2,3,4,5}.

> powerset({1,2,3,4,5});

Find all partitions of the integer 8.

Find the number of partitions of the integer 100.

Generate a list containing all distinct ordered triples of positive integers whose elements sum to 7.

> composition(7,3);

Generate a list of all sequences of 5 zeros and ones such that each successive pair of sequences differ in only one term.

> g := graycode(5);

> printf(cat(` %.5d`\$32), op(map(convert, g, binary))); lprint();

00000 00001 00011 00010 00110 00111 00101 00100 01100 01101 01111 01110 01010 01011 01001 01000 11000 11001 11011 11010 11110 11111 11101 11100 10100 10101 10111 10110 10010 10011 10001 10000

Find the number of ways to partition 5 things into subsets.