> #Please do not post ; > #Yifan Zhang, HW5, 09/25/2020 ; > ; > #Q1. ; > #Prove: Let P_j(n) be the set of permutations of {1, ..., n}. P_j(0) is the set of empty permutation; P_j(1) = {1}; P_j(2) = {12, 21}; P_j(3) = {123, 132, 213, 231, 312, 321}; P_j(4) = {1234, ..., 4321}; > #so we can know the number of elements of P_j(n) for n = 0, ..., n is p(0) = 0; p(1) = 1; p(2) = 2; p(3) = 6; p(3) = 3 * p(2), and for mutually disjoint sets, |A union B union C| = |A|+|B|+|C| => {123, 132, 213, 231, 312, 321} = {312, 321} union {123, 132} union {213, 231}; > #which implies that |P_j(n)| = n! and since |P_j(n-1)| = (n-1)!, then p(n) = n! = n*(n-1)! = n* |P_j(n-1)| = n*p(n-1) ; > ; > ; > #Q2. (confused) ; > #p(n) = |P(a1,a2,a3,n)| = nops(permute(x*a1, y*a2, z*a3)), for all cases that x*a1+y*a2+z*a3 = n ; > ; > ; > #Q3. ; > SEQP := proc(a1,a2,a3, N) local i, j, k, L, S; > option remember: > L:= partition(N); > for i from 1 to nops(L) do > for j from 1 to nops(L[i]) do > if L[i][j] <>a1 or L[i][j] <> a2 or L[i][j] <>a3 then > subsop(L[i], L); > fi: > od: > od: > for k from 1 to nops(L) do > S:= nops(permute(L[k])) + S: > od: > > S > end: > > ; > ; > #Q4. ; > #How many time he is INCLUDED in line 1. Ans: 2 > #How many time he is EXCLUDED in line 2. Ans: 1 > #How many time he is INCLUDED (again) in line 3 (possibly none). Ans: none > #How many time he is EXCLUDED (again) in line 4 (possibly none). Ans: none ; > 2-1+3-4 = 0 ; > #Do the analogous thing for a lucky person who is lucky to be clever AND strong AND good-looking AND kind-hearted. ; > #line1: 4 ; > #line2: 6 ; > #line3: 4 ; > #line4: 1 ; > 4-6+4-1 = 1 ;