#OK to post homework #Tianyi Liu,Sept 20, Assignment 3 1. Bnk(10,5)[20] [0, 0, 0, 1, 1, 1, 1, 0, 1, 0] MyChoose({1,2,3,4,5,6},2)[5] {1, 6} MyPermsL([r,u,t,g,e,r,s])[100] [r, u, s, t, e, r, g] WtoS([1,0,0,0,1]) {1, 5} 2. NuFP:=proc(pi) local nu,i,n: n:=nops(pi): nu:=0: if n=0 then RETURN (nu): fi: for i from 1 to n do if i=pi[i] then nu:=nu+1: fi: od: nu: end: 3. Der:=proc(n) local L,i,S,nu: S:={}: L:=MyPerms(n): nu:=nops(L): for i from 1 to nu do if NuFP(L[i])=0 then S:=S union {L[i]}: fi: od: S: end: 4. [seq(nops(Der(i)),i=0..8)] [1, 0, 1, 2, 9, 44, 265, 1854, 14833] Yes. A000166:Subfactorial or rencontres numbers, or derangements: number of permutations of n elements with no fixed points. 5. [seq(nops(Comps(i)),i=1..8)] [1, 2, 4, 8, 16, 32, 64, 128] nops(Comps(i))=2^(i-1)